18.02.2012, 15:52
Stop begging pity for rep! By the way, this godmode would NOT work, 'cause if somebody would shooting at you with e.g. a minigun, your health would be fucked up in a minute! Try mine, you need to update stuff:
Simple, and not too long!
PHP код:
new HasGod[MAX_PLAYERS];
PHP код:
CMD:god(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 8)
{
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 have to be level 8 to use that command!");
return 1;
}
PHP код:
public OnPlayerConnect(playerid) {
HasGod[playerid] = 0;
return 1;
}
PHP код:
public OnPlayerUpdate(playerid)
{
if(HasGod[playerid] == 1)
{
SetTimer("SetHealth", 100, true);
}
return 1;
}
PHP код:
forward SetHealth(playerid);
public SetHealth(playerid) //this is a callback
{
SetPlayerHealth(playerid, 100);
return 1;
}