30.07.2011, 09:19
This is the right way to make a god command;
You have to download Zcmd include and put it into [yourserver name]/pawno/includes.
pawn Код:
//At top
#include <zcmd> //Credits to Zeex
new HasGod[MAX_PLAYERS];
public OnPlayerConnect(playerid) //This is a callback
{
HasGod[playerid] = 0;
return 1;
}
//Otside ANY callback
CMD:god(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(HasGod[playerid] == 0)
{
HasGod[playerid] = 1;
SendClientMessage(playerid, -1, "God mode turned on!");
}
else if(HasGod[playerid] == 1)
{
HasGod[playerid] = 0;
SendClientMessage(playerid, -1, "God mode turned off!");
}
}
else return SendClientMessage(playerid, -1, "You are not an admin");
return 1;
}
public OnPlayerUpdate(playerid) //this is a callback
{
if(HasGod[playerid] == 1)
{
SetTimer("SetHealth", 100, true);
}
return 1;
}
forward SetHealth(playerid);
public SetHealth(playerid) //this is a callback
{
SetPlayerHealth(playerid, 100);
return 1;
}