28.03.2019, 09:04
This is barely a filterscript and more of a snippet; And use an array, all what you guys think is that arrays are for storing player data into the memory but you can use it for thousands of other purposes as well, same goes that thousands of you just use Streamer for objects whereas you forget the functionality it gives to make codes smaller, same goes with other plugins and tools already available..
PS: there might be minor mistakes in the code, written this on the browser just as an example.
PHP Code:
#define MAX_RANKS (3)
#define MAX_RANK_NAME (32)
enum e_RankingStructure {
e_RankingName[MAX_RANK_NAME],
e_RankingScore,
e_RankingColor
};
new const g_RankingStructure[MAX_RANKS][e_RankingStructure] {
{"Newbie", 0, 0xFFFFFFFF},
{"Wannabe", 50, 0xFF0000FF},
{"Scripter", 100, 0x00FFFFFF}
};
Rank_GetPlayer(playerid) {
new
score = GetPlayerScore(playerid);
for (new i = MAX_RANKS; i != 0; i --) {
if (score >= g_RankingStructure[i][e_RankingScore])
return i;
}
return 0;
}
