30.08.2011, 20:10
Using switch is indeed the best thing here. But to answer the else-question: Else is a good thing to use here, as it can safe you 50% of the conditions and so optimizes the code a lot:
pawn Код:
stock UpdateRank(playerid)
{
new string[128];
if(PInfo[playerid][Owner] == 1) return format(pRank[playerid],128,"Server Owner");
if(PInfo[playerid][Level] < 500) return format(pRank[playerid],128,"Administrator");
if(PInfo[playerid][Missionspassed] >= 0 && PInfo[playerid][Missionspassed] < 10) return format(pRank[playerid],128,"New Trucker");
else if(/*PInfo[playerid][Missionspassed] >= 10 && */PInfo[playerid][Missionspassed] < 25) return format(pRank[playerid],128,"Trucker");
else if(/*PInfo[playerid][Missionspassed] >= 25 && */PInfo[playerid][Missionspassed] < 45) return format(pRank[playerid],128,"Advancing Trucker");
// first condition is already checked, so not needed
// ...
}