13.12.2015, 17:47
Quote:
It is because you are assigning admin rank 1 to the place where your variable returns 0 which should be player.
You need to do something like this instead. PHP код:
|
PHP код:
MyFunction(playerid) {
new switchid = 2;
switch(switchid) {
case 0: print("Hi");
case 1: print("Hi");
case 2: print("Hi"); // jumps to case 2 straight away.
}
return true;
}
MyFunction(playerid) {
new switchid = 2;
if(switchid == 0) return print("Hi"); //checks
else if(switchid == 1) return print("Hi"); //checks
else if(switchid == 2) return print("Hi"); //checks
return true;
}
PHP код:
MyFunction(playerid) {
new switchid = 2;
switch(switchid) {
case 1: print("Hi");
case 2: print("Hi"); // jumps to case 2 straight away.
default: print("Not 1 or 2"); //if it isnt 1-2
}
return true;
}
PHP код:
stock GetPlayerAdminRank(playerid)
{
new level[64];
switch (PlayerInfo[playerid][pAdministrator])
{
case 1: level = "{FF0000}Admin I{FFFFFF}";
case 2: level = "{FF0000}Admin II{FFFFFF}";
case 3: level = "{FF0000}Admin III{FFFFFF}";
case 4: level = "{FF0000}Direktor{FFFFFF}";
case 5: level = "{FF0000}Vlasnik{FFFFFF}";
default: level = "Player";
}
return level;
}