I hit F2 to open the inventory and I get that, but I restart it and now it works, but the same thing always happens to me

This is normally the case when your player is flagged as DEAD From another script
Normally occurs from the esx_ambulancejob

Could it be because when I die I relive from the console?

yes that would be exactly whey