SA-MP Forums Archive
Duty Bug |help +rep| - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Duty Bug |help +rep| (/showthread.php?tid=545168)



Duty Bug |help +rep| - AYOUYOU - 06.11.2014

When i do /duty
he said Admin Onduty Try do again /duty said Onduty again
He don't Say Off-Duty
PHP код:
YCMD:duty(playeridparams[], help)
{
        
#pragma unused help
        #pragma unused params
        
if(P_Data[playerid][pAdmin] == 3) return SCM(playeridCOLOR_RED"You aren't an admin!");
        new
            
string[128];
        if(
P_Data[playerid][pDuty] == 3) {
        
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] = 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] = 1;}
        return 
1;

+rep if you help me


Re: Duty Bug |help +rep| - dominik523 - 06.11.2014

Set pDuty to 3 when the admin is on duty.
pawn Код:
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!");
        new
            string[128];
        if(P_Data[playerid][pDuty] == 3) {
        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] = 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;} // <---- This
        return 1;
}