28.12.2013, 23:31
Any tips to how optimize this code?
This code sets, in based of the rank of the player, the armour.
Forgive the bad identation, i dont know why [pawn] tag mixes the code spaces.
pawn Код:
stock RankArmour(playerid)
{
switch(pInfo[playerid][Rank])
{
case 1: SetPlayerArmour(playerid,10);
case 2: SetPlayerArmour(playerid,20);
case 3: SetPlayerArmour(playerid,30);
case 4: SetPlayerArmour(playerid,40);
case 5: SetPlayerArmour(playerid,50);
case 6: SetPlayerArmour(playerid,60);
case 7: SetPlayerArmour(playerid,70);
case 8: SetPlayerArmour(playerid,80);
case 9:SetPlayerArmour(playerid,85);
case 10:SetPlayerArmour(playerid,MAX_ARMOUR);
case 11:SetPlayerArmour(playerid,MAX_ARMOUR);
case 12:SetPlayerArmour(playerid,MAX_ARMOUR);
case 13:SetPlayerArmour(playerid,MAX_ARMOUR);
case 14:SetPlayerArmour(playerid,MAX_ARMOUR);
case 15:SetPlayerArmour(playerid,MAX_ARMOUR);
case 16:SetPlayerArmour(playerid,MAX_ARMOUR);
case 17:SetPlayerArmour(playerid,MAX_ARMOUR);
case 18:SetPlayerArmour(playerid,MAX_ARMOUR);
case 19:SetPlayerArmour(playerid,MAX_ARMOUR);
case 20:SetPlayerArmour(playerid,MAX_ARMOUR);
case 21:SetPlayerArmour(playerid,MAX_ARMOUR);
case 22:SetPlayerArmour(playerid,MAX_ARMOUR);
case 23:SetPlayerArmour(playerid,MAX_ARMOUR);
case 24:SetPlayerArmour(playerid,MAX_ARMOUR);
case 25:SetPlayerArmour(playerid,MAX_ARMOUR);
case 26:SetPlayerArmour(playerid,MAX_ARMOUR);
case 27:SetPlayerArmour(playerid,MAX_ARMOUR);
case 28:SetPlayerArmour(playerid,MAX_ARMOUR);
case 29:SetPlayerArmour(playerid,MAX_ARMOUR);
case 30:SetPlayerArmour(playerid,MAX_ARMOUR);
case 31:SetPlayerArmour(playerid,MAX_ARMOUR);
case 32:SetPlayerArmour(playerid,MAX_ARMOUR);
case 33:SetPlayerArmour(playerid,MAX_ARMOUR);
case 34:SetPlayerArmour(playerid,MAX_ARMOUR);
case 35:SetPlayerArmour(playerid,MAX_ARMOUR);
case 36:SetPlayerArmour(playerid,MAX_ARMOUR);
case 37:SetPlayerArmour(playerid,MAX_ARMOUR);
case 38:SetPlayerArmour(playerid,MAX_ARMOUR);
case 39:SetPlayerArmour(playerid,MAX_ARMOUR);
case 40:SetPlayerArmour(playerid,MAX_ARMOUR);
case 41:SetPlayerArmour(playerid,MAX_ARMOUR);
case 42:SetPlayerArmour(playerid,MAX_ARMOUR);
case 43:SetPlayerArmour(playerid,MAX_ARMOUR);
case 44:SetPlayerArmour(playerid,MAX_ARMOUR);
}
}
Forgive the bad identation, i dont know why [pawn] tag mixes the code spaces.