17.07.2011, 14:37
pawn Код:
//Out of any callback, down the defines
new GodMode[MAX_PLAYERS] = 0;
new GMTimer;
//ZCMD command, outside any callback
COMMAND:godmode(playerid, cmdtext[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Youre not admin!");
if(GodMode[playerid] == 0)
{
GMTimer = SetTimerEx("GodMod", 1500, true, "i", playerid);
SetPlayerHealth(playerid, 10000);
SendClientMessage(playerid, -1, "God mode is now on");
GodMode[playerid] = 1;
}
else
{
KillTimer(GMTimer);
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, -1, "God mode is now off");
GodMode[playerid] = 0;
}
return 1;
}
//Forward and public, out of any callback aswell
forward GodMod(playerid);
public GodMod(playerid)
{
SetPlayerHealth(playerid, 10000);
return 1;
}