Difference between else and else if
#3

Let's take an example :
There is an admin command making you in GODMODE.
PHP код:
CMD:god(playerid,params[])
{
     if(
PlayerInfo[playerid][pAdminlvl] >= && PlayerGodMode[playerid] == 1// If the player has AT LEAST a admin lvl > 4 AND he is NOT in godmode
    
{
        
PlayerGodMode[playerid] = 2;
        
SendClientMessage(playerid, -1"Godmode on");
        
GOD SetTimerEx("GodMode"100true"i"playerid);
        return 
1;
    }
     else if(
PlayerInfo[playerid][pAdminlvl] >= && PlayerGodMode[playerid] == 2// ELSE IF the player has AT LEAST a admin lvl > 4 AND he IS in godmode.
    
{
        
SendClientMessage(playerid, -1"Godmode off");
        
KillTimer(GOD);
        
PlayerGodMode[playerid] = 1;
        
SetPlayerHealth(playerid100.0);
        
SetPlayerArmour(playerid100.0);
        return 
1;
    }
      else return 
SendClientMessage(playeridred"You are not allowed to use this command."); // ELSE : the player isn't admin

I hope you understand the difference. By the way check THIS.
Reply


Messages In This Thread
Difference between else and else if - by Nin9r - 24.05.2016, 09:55
Re: Difference between else and else if - by ratxrat - 24.05.2016, 10:28
Re: Difference between else and else if - by Dayrion - 24.05.2016, 10:28
Re: Difference between else and else if - by Nin9r - 19.06.2016, 12:36
Re: Difference between else and else if - by Konstantinos - 19.06.2016, 12:39
Re: Difference between else and else if - by Vince - 19.06.2016, 12:59
Re: Difference between else and else if - by Nin9r - 19.06.2016, 17:45
Re: Difference between else and else if - by Luicy. - 19.06.2016, 17:49
Re: Difference between else and else if - by FuNkYTheGreat - 19.06.2016, 17:56

Forum Jump:


Users browsing this thread: 1 Guest(s)