Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum e_top_richlist
- {
- E_playerid,
- E_money
- };
- //---------//
- CMD:listabogatih(playerid, params[])
- {
- new richlist[MAX_PLAYERS][e_top_richlist],
- finstring[2048] = "#\tIgrac\tUkupna svota\n",
- tmpstring[68];
- for(new i = 0; i < MAX_PLAYERS; i++) //Mozete i foreach/GetPlayerPoolSize....
- {
- if (IsLoggedIn[i] == 1) //Stavite vasu provjeru za provjeru jeli je igrac logiran
- {
- richlist[i][E_playerid] = i;
- richlist[i][E_money] = GetPlayerCash(i);
- }
- else
- {
- richlist[i][E_playerid] = -1;
- richlist[i][E_money] = -1;
- }
- }
- SortDeepArray(richlist, E_money, .order = SORT_DESC);
- for(new i = 0; i < 20; i++)
- {
- if(richlist[i][E_money] != -1)
- format(tmpstring, sizeof(tmpstring), "%i.\t%s\t$%s\n", i + 1, GetName(richlist[i][E_playerid]), number_format(richlist[i][E_money]));
- else
- format(tmpstring, sizeof(tmpstring), "%i. N/A\n", i + 1);
- strcat(finstring, tmpstring);
- }
- ShowPlayerDialog(playerid, RICHLIST_DIALOG, DIALOG_STYLE_TABLIST_HEADERS, "Najbogatiji Igraci (Online)", finstring, "OK", "");
- return 1;
- }
- //---------//
- number_format(num)
- {
- new szStr[16];
- format(szStr, sizeof(szStr), "%i", num);
- for(new iLen = strlen(szStr) - (num < 0 ? 4 : 3); iLen > 0; iLen -= 3)
- {
- strins(szStr, ",", iLen);
- }
- return szStr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement