01.12.2013, 16:55
So i have a exp/rank system going but i am not sure if this is the best and correct way to do this.
note that the timer doesnt really work... when i set the exp using a command it doesnt work correctly and when another player joins his exp changes but not his rank, should i loop true all the players or how does this work?
thanks
note that the timer doesnt really work... when i set the exp using a command it doesnt work correctly and when another player joins his exp changes but not his rank, should i loop true all the players or how does this work?
pawn Код:
forward rankcheck(playerid);
//under ongamemodeinit
SetTimer("rankcheck", 500, true);
public rankcheck(playerid)
{
if(User[playerid][USER_EXP] == 0) return User[playerid][USER_RANK] = 0;
if(User[playerid][USER_EXP] == 500) return User[playerid][USER_RANK] = 1;
if(User[playerid][USER_EXP] == 1000) return User[playerid][USER_RANK] = 2;
if(User[playerid][USER_EXP] == 2000) return User[playerid][USER_RANK] = 3;
if(User[playerid][USER_EXP] == 3500) return User[playerid][USER_RANK] = 4;
if(User[playerid][USER_EXP] == 4000) return User[playerid][USER_RANK] = 5;
if(User[playerid][USER_EXP] == 5000) return User[playerid][USER_RANK] = 6;
if(User[playerid][USER_EXP] == 5500) return User[playerid][USER_RANK] = 7;
if(User[playerid][USER_EXP] == 7000) return User[playerid][USER_RANK] = 8;
if(User[playerid][USER_EXP] == 8500) return User[playerid][USER_RANK] = 9;
if(User[playerid][USER_EXP] == 10000) return User[playerid][USER_RANK] = 10;
if(User[playerid][USER_EXP] == 10500) return User[playerid][USER_RANK] = 11;
if(User[playerid][USER_EXP] == 11000) return User[playerid][USER_RANK] = 12;
if(User[playerid][USER_EXP] == 12000) return User[playerid][USER_RANK] = 13;
if(User[playerid][USER_EXP] == 13500) return User[playerid][USER_RANK] = 14;
if(User[playerid][USER_EXP] == 14000) return User[playerid][USER_RANK] = 15;
if(User[playerid][USER_EXP] == 15000) return User[playerid][USER_RANK] = 16;
if(User[playerid][USER_EXP] == 15500) return User[playerid][USER_RANK] = 17;
if(User[playerid][USER_EXP] == 17000) return User[playerid][USER_RANK] = 18;
if(User[playerid][USER_EXP] == 18500) return User[playerid][USER_RANK] = 19;
if(User[playerid][USER_EXP] == 20000) return User[playerid][USER_RANK] = 20;
if(User[playerid][USER_EXP] == 20500) return User[playerid][USER_RANK] = 21;
if(User[playerid][USER_EXP] == 21000) return User[playerid][USER_RANK] = 22;
if(User[playerid][USER_EXP] == 22000) return User[playerid][USER_RANK] = 23;
if(User[playerid][USER_EXP] == 23500) return User[playerid][USER_RANK] = 24;
if(User[playerid][USER_EXP] == 24000) return User[playerid][USER_RANK] = 25;
if(User[playerid][USER_EXP] == 25000) return User[playerid][USER_RANK] = 26;
if(User[playerid][USER_EXP] == 25500) return User[playerid][USER_RANK] = 27;
if(User[playerid][USER_EXP] == 27000) return User[playerid][USER_RANK] = 28;
if(User[playerid][USER_EXP] == 28500) return User[playerid][USER_RANK] = 29;
if(User[playerid][USER_EXP] == 30000) return User[playerid][USER_RANK] = 30;
if(User[playerid][USER_EXP] == 30500) return User[playerid][USER_RANK] = 31;
if(User[playerid][USER_EXP] == 31000) return User[playerid][USER_RANK] = 32;
if(User[playerid][USER_EXP] == 32000) return User[playerid][USER_RANK] = 33;
if(User[playerid][USER_EXP] == 33500) return User[playerid][USER_RANK] = 34;
if(User[playerid][USER_EXP] == 34000) return User[playerid][USER_RANK] = 35;
if(User[playerid][USER_EXP] == 35000) return User[playerid][USER_RANK] = 36;
if(User[playerid][USER_EXP] == 35500) return User[playerid][USER_RANK] = 37;
if(User[playerid][USER_EXP] == 37000) return User[playerid][USER_RANK] = 38;
if(User[playerid][USER_EXP] == 38500) return User[playerid][USER_RANK] = 39;
if(User[playerid][USER_EXP] == 40000) return User[playerid][USER_RANK] = 40;
if(User[playerid][USER_EXP] == 40500) return User[playerid][USER_RANK] = 41;
if(User[playerid][USER_EXP] == 41000) return User[playerid][USER_RANK] = 42;
if(User[playerid][USER_EXP] == 42000) return User[playerid][USER_RANK] = 43;
if(User[playerid][USER_EXP] == 43500) return User[playerid][USER_RANK] = 44;
if(User[playerid][USER_EXP] == 44000) return User[playerid][USER_RANK] = 45;
if(User[playerid][USER_EXP] == 45000) return User[playerid][USER_RANK] = 46;
if(User[playerid][USER_EXP] == 45500) return User[playerid][USER_RANK] = 47;
if(User[playerid][USER_EXP] == 47000) return User[playerid][USER_RANK] = 48;
if(User[playerid][USER_EXP] == 48500) return User[playerid][USER_RANK] = 49;
if(User[playerid][USER_EXP] == 50000) return User[playerid][USER_RANK] = 50;
if(User[playerid][USER_EXP] == 50500) return User[playerid][USER_RANK] = 51;
if(User[playerid][USER_EXP] == 51000) return User[playerid][USER_RANK] = 52;
if(User[playerid][USER_EXP] == 52000) return User[playerid][USER_RANK] = 53;
if(User[playerid][USER_EXP] == 53500) return User[playerid][USER_RANK] = 54;
if(User[playerid][USER_EXP] == 54000) return User[playerid][USER_RANK] = 55;
if(User[playerid][USER_EXP] == 55000) return User[playerid][USER_RANK] = 56;
if(User[playerid][USER_EXP] == 55500) return User[playerid][USER_RANK] = 57;
if(User[playerid][USER_EXP] == 57000) return User[playerid][USER_RANK] = 58;
if(User[playerid][USER_EXP] == 58500) return User[playerid][USER_RANK] = 59;
if(User[playerid][USER_EXP] == 60000) return User[playerid][USER_RANK] = 60;
return 1;
}