How to "switch"
#2

pawn Код:
new string[128], Nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nick, sizeof(Nick));
    switch(Player[playerid][pAdminLevel])
    {
        case 3: //If Player[playerid][pAdminLevel] equals to 3.
        {
            format(string, sizeof(string), "(Junior Admin ID:%d): %s",playerid, text);
            SendPlayerMessageToAll(playerid, string);
        }
        case 4: //If Player[playerid][pAdminLevel] equals to 4.
        {
            format(string, sizeof(string), "(Admin ID:%d): %s",playerid, text);
            SendPlayerMessageToAll(playerid, string);
        }
        case 5: //If Player[playerid][pAdminLevel] equals to 5.
        {
            format(string,sizeof(string), "(Head Admin ID:%d): %s", playerid, text);
            SendPlayerMessageToAll(playerid, string);
        }
        default: //If all of the cases above are false.
        {
            format(string, sizeof(string), "(ID:%d): %s", playerid, text);
            SendPlayerMessageToAll(playerid, string);
        }
    }
http://wiki.amxmodx.org/Pawn_Tutorial#Switch_Statements
Reply


Messages In This Thread
How to "switch" - by micol - 07.01.2013, 15:25
Re: How to "switch" - by gtakillerIV - 07.01.2013, 15:38
Re: How to "switch" - by AndreT - 07.01.2013, 15:44
Re: How to "switch" - by micol - 07.01.2013, 19:59
Re: How to "switch" - by gtakillerIV - 08.01.2013, 17:14
Re: How to "switch" - by micol - 09.01.2013, 11:44

Forum Jump:


Users browsing this thread: 1 Guest(s)