09.11.2014, 07:26
pawn Код:
new duty[MAX_PLAYERS];
//somewhere under the includes, etc
public OnPlayerConnect(playerid)
{
duty[playerid] =0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
duty[playerid] =0;
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
duty[playerid] =0;
return 1;
}
public OnPlayerSpawn(playerid)
{
duty[playerid] =0;
return 1;
}
YCMD:duty(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(P_Data[playerid][pAdmin] == 3) return SCM(playerid, COLOR_RED, "You aren't an admin!");
else
{
if(duty[playerid] == 1)
{
new string[128];
SetPlayerHealth(playerid,100);
SetPlayerColor(playerid,-1);
format(string,sizeof(string)," {FF0000} %s is now off Duty!",GetName(playerid));
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;}
duty[playerid] =1;
}
else
{
format(string,sizeof(string)," {FF0000} %s is now on Duty!",GetName(playerid));
SetPlayerHealth(playerid,99999);
SetPlayerColor(playerid,0xFF000000);
SCMToAll(-1,string);
P_Data[playerid][pDuty] = 3;
}
}
return 1;
}