[FilterScript] Sonny's Ranking system [Based on Scores, Cash] + Extra: Ping
#7

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..

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"00xFFFFFFFF},
        {
"Wannabe"500xFF0000FF},
        {
"Scripter"1000x00FFFFFF}
};
Rank_GetPlayer(playerid) {
        
        new
                
score GetPlayerScore(playerid);
        for (new 
MAX_RANKS!= 0--) {
                if (
score >= g_RankingStructure[i][e_RankingScore])
                        return 
i;
        }
        return 
0;

PS: there might be minor mistakes in the code, written this on the browser just as an example.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)