/badge for factions
#5

I actually didn't bother to check the code, I just fixed the indentation. Using "else" statement will solve it:
PHP код:
CMD:badge(playeridparams[])
{
    if(
pInfo[playerid][Faction] == || pInfo[playerid][Faction] >= 3) return SendClientMessage(playerid0x46E850FF"SERVER:{FFFFFF} You're not authorized to use this command!");
    
pDuty[playerid] = !pDuty[playerid];
    switch(
pInfo[playerid][Faction])
    {
        case 
1:
        {
            if(
pDuty[playerid])
            {
                
SendClientMessage(playeridCOLOR_WHITE"You are now on Duty");
                
SetPlayerColor(playeridCOLOR_PDRAD);
            }
            else
            {
                
// off duty
            
}
        }
        case 
2:
        {
            if(
pDuty[playerid])
            {
                
SendClientMessage(playeridCOLOR_WHITE"You are now on Duty");
                
SetPlayerColor(playeridCOLOR_RED);
            }
            else
            {
                
// off duty
            
}
        }
        case 
3:
        {
            if(!
pDuty[playerid])
            {
                
SendClientMessage(playeridCOLOR_WHITE"You are now off Duty");
                
SetPlayerColor(playeridCOLOR_WHITE);
            }
            else
            {
                
// on duty
            
}
        }
    }
    return 
1;

EDIT: Updated because setting the value before the switch.
Reply


Messages In This Thread
/badge for factions - by CSLangdale - 16.04.2016, 09:42
Re: /badge for factions - by CSLangdale - 16.04.2016, 09:45
Re: /badge for factions - by Konstantinos - 16.04.2016, 09:55
Re: /badge for factions - by CSLangdale - 16.04.2016, 10:00
Re: /badge for factions - by Konstantinos - 16.04.2016, 10:09
Re: /badge for factions - by ghost556 - 16.04.2016, 10:16
Re: /badge for factions - by Prokill911 - 16.04.2016, 11:52

Forum Jump:


Users browsing this thread: 3 Guest(s)