24.08.2014, 17:08
hey, guys, I made a god command which looks kind of like this:
(I stored the player's current health so the command won'g get abused)
The problem is, everytime I connect to my server, and type /god for the first time, I die.
After that first time, it works as it should. Does anyone know how can I solve this?
(I stored the player's current health so the command won'g get abused)
PHP код:
YCMD:god(playerid, params[], help)
{
if(godmode[playerid]==false)
{
godmode[playerid]=true;
ResetPlayerWeapons(playerid);
GetPlayerHealth(playerid, phealth[playerid]);
GetPlayerArmour(playerid, parmor[playerid]);
SetPlayerHealth(playerid, 0x7F800000);
}
else
{
godmode[playerid]=false;
SetPlayerHealth(playerid, phealth[playerid]);
SetPlayerArmour(playerid, parmor[playerid]);
}
return 1;
}
After that first time, it works as it should. Does anyone know how can I solve this?