10.03.2017, 06:09
Firstly on top of ur script add:
new aDuty[MAX_PLAYERS];
Secondly Under OnPlayerConnect add:
aDuty[playerid] = 0; // This will set the players admin duty off when he connects
Do the same under OnPlayerDisconect
And then here is the code fixed:
I did this on my mobile so I didn't test it, but I think it should work
new aDuty[MAX_PLAYERS];
Secondly Under OnPlayerConnect add:
aDuty[playerid] = 0; // This will set the players admin duty off when he connects
Do the same under OnPlayerDisconect
And then here is the code fixed:
PHP код:
.CMD:aduty(playerid, params[])
{
if(adlvl[playerid]<1) return 0;
new pname[64], str[150];
GetPlayerName(playerid, pname, sizeof(pname));
for(new i=0; i< MAX_PLAYERS; i++)
{
if(aDuty[playerid] == 0)
{
SetPlayerMarkerForPlayer(playerid, i, (GetPlayerColor(playerid)));
format(str,sizeof(str),"Admin[%s] Is Now [ON] Duty", pname);
SendClientMessageToAll(COLOR_GREEN,str);
aDuty[playerid] = 1;
// You don't return 1 else it wouldn't set him on duty
}
else if (aDuty[playerid] == 1) // This Will check if he's on duty
{
SetPlayerMarkerForPlayer(playerid, i, 00);
format(str,sizeof(str),"Admin[%s] Is Now [OFF] Duty", pname);
SendClientMessageToAll(COLOR_GREEN,str);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
aDuty[playerid] = 0;
// Again u don't return 1
}
return 1;
}
return 1;
}