27.11.2012, 15:59
this will not work because playerid is not there in the callback..
you ahd rather create this command using your normal command processor and then before the command check if player is admin or not using if(!IsPlayerAdmin(playerid))
example -
you ahd rather create this command using your normal command processor and then before the command check if player is admin or not using if(!IsPlayerAdmin(playerid))
example -
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/god", true))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not an admin");
SendClientMessageToAll(0xDEEE20FF, "An admin has enabled his GODMODE!");
SetPlayerHealth(playerid, 9999999999999999999999);
SetPlayerArmour(playerid, 9999999999999999999999.0);
return 1;
}
if(!strcmp(cmd,"/ungod",true))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not an admin");
SendClientMessageToAll(0xDEEE20FF, "An admin has disabled his GODMODE!");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0.0);
}
return 0;
}