changing if else to switch(...) case
#1

PHP код:
if(pInfo[playerid][Adminlevel] == 1)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 1 ~g~~n~(Trial moderator) ",3000,3);
                }
                else if(
pInfo[playerid][Adminlevel] == 2)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 2 ~g~~n~(Moderator) ",3000,3);
                }
                else if(
pInfo[playerid][Adminlevel] == 3)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 3 ~g~~n~(Junior Administrator) ",3000,3);
                }
                else if(
pInfo[playerid][Adminlevel] == 4)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 4 ~g~~n~(Senior Administrator) ",3000,3);
                }
                else if(
pInfo[playerid][Adminlevel] == 5)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 5 ~g~~n~(Master Administrator) ",3000,3);
                }
                else if(
pInfo[playerid][Adminlevel] == 6)
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in~n~ Adminlevel 6 ~g~~n~(Server Owner) ",3000,3);
                }
                else
                {
                    
GameTextForPlayer(playerid,"~b~Welcome!~w~ Logged in",3000,3);
                } 
How do i write the code above using
PHP код:
switch()
{
case 
0:
case 
1:
and 
so on

Reply


Messages In This Thread
changing if else to switch(...) case - by xTURBOx - 03.11.2015, 11:54
Re: changing if else to switch(...) case - by HydraHumza - 03.11.2015, 12:03
Re: changing if else to switch(...) case - by xTURBOx - 03.11.2015, 12:10

Forum Jump:


Users browsing this thread: 4 Guest(s)