aDuty Help
#2

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:
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; 
} 
I did this on my mobile so I didn't test it, but I think it should work
Reply


Messages In This Thread
aDuty Help - by silverms - 09.03.2017, 20:08
Re: aDuty Help - by Immortal99 - 10.03.2017, 06:09
Re: aDuty Help - by Toroi - 10.03.2017, 06:13
Re: aDuty Help - by silverms - 10.03.2017, 06:15
Re: aDuty Help - by Toroi - 10.03.2017, 06:24

Forum Jump:


Users browsing this thread: 1 Guest(s)