07.03.2014, 01:19
For one /god command:
pawn Код:
new bool:GodModeActive[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
if(GodModeActive[playerid] ? SetPlayerHealth(playerid, (Float:0x7F800000)) : SetPlayerHealth(playerid, 100.0)) {}
return 1;
}
CMD:god(playerid, params[])
{
//if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin."); //Change this to your admin variable.
//Uncomment the line above if you want to restrict this command to admins only.
if(GodModeActive[playerid])
{
GodModeActive[playerid] = false;
SendClientMessage(playerid, -1, "God mode disabled.");
SetPlayerHealth(playerid, 100.0);
}
else if(!GodModeActive[playerid])
{
GodModeActive[playerid] = true;
SendClientMessage(playerid, -1, "God mode activated.");
SetPlayerHealth(playerid,(Float:0x7F800000));
}
return 1;
}