PHP код:
new aod[MAX_PLAYERS];
OnPlayerConnect(playerid)
{
aod[playerid] = 0;//add this on playerconnect so that it will set 0 for all the players
return 1;
}
CMD:aod(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(aod[playerid] == 0)
{
aod[playerid] = 1;
ResetPlayerWeapons(playerid);
SendClientMessage(playerid,COLOR_GREY,"{1AE694}» {EA15D5}You're now on duty. (Dont abuse it");
GivePlayerWeapon(playerid,43,100);
SetPlayerSkin(playerid,294);
SetPlayerHealth(playerid,999999);
SetPlayerColor(playerid,0xEA15D5C8);
new Text3D:label = Create3DTextLabel("ADMIN ON DUTY!", 0xEA15D5C8, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
}
else
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
SetPlayerColor(playerid, 0xFFFFFF00);
Delete3DTextLabel(label[playerid]);
aod[playerid] = 0; //reset it to 0 so that they can use the cmd again
//add more stuffs to reset or normalize as a normal player
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this cmd");
}
return 1;
}
Sorry but i edited that inside the sa-mp forum, thats why there maybe some loose indentation warnings.