SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/08/2015, 11:04 PM   #1
kyriakos587
Huge Clucker
 
kyriakos587's Avatar
 
Join Date: Sep 2012
Posts: 276
Reputation: 15
Default Rich list Help

Hi i want to make /richlist command. With this command you can see the top 10 players who have the most money of server

Like this:

---Rich List---
TheNewFuture(ID:0) - 9999999$
Undertaken(ID:1) - 191991$
SkataNaFate(ID:2) - 2813$
Continues...

But i want only 10 players
__________________
Tutorials
None

FilterScript
Song System
AntiSpawn System
CoolAdmin Version

Current Project
Ultimate Gaming Freeroam(5%)
kyriakos587 is offline   Reply With Quote
Old 31/08/2015, 11:13 PM   #2
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,277
Reputation: 366
Default Re: Rich list Help

PHP Code:
#include a_samp
#include zcmd

#define COLOR_WHITE 0xFFFFFFAA

CMD:richlist(playerid,params[]) {
    
#pragma unused params
        
new string[128], Slot1 = -1Slot2 = -1Slot3 = -1Slot4 = -1Slot5 = -1Slot6 = -1Slot7 = -1Slot8 = -1Slot9 = -1Slot10 = -1HighestCash = -9999;
        
SendClientMessage(playerid,COLOR_WHITE,"Rich List:");

        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot1 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot2 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot3 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot4 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot5 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4 && != Slot5) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot6 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4 && != Slot5 && != Slot6) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot7 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4 && != Slot5 && != Slot6 && != Slot7) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot8 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4 && != Slot5 && != Slot6 && != Slot7 && != Slot8) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot9 x;
        }
        
HighestCash = -9999;
        for(new 
x=0x<MAX_PLAYERSx++) if (IsPlayerConnected(x) && != Slot1 && != Slot2 && != Slot3 && != Slot4 && != Slot5 && != Slot6 && != Slot7 && != Slot8 && != Slot9) if (GetPlayerMoney(x) >= HighestCash) {
            
HighestCash GetPlayerMoney(x);
            
Slot10 x;
        }
        
format(stringsizeof(string), "(%d) %s - $%d"Slot1,PlayerName2(Slot1),GetPlayerMoney(Slot1) );
        
SendClientMessage(playerid,COLOR_WHITE,string);
        if(
Slot2 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot2,PlayerName2(Slot2),GetPlayerMoney(Slot2) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot3 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot3,PlayerName2(Slot3),GetPlayerMoney(Slot3) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot4 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot4,PlayerName2(Slot4),GetPlayerMoney(Slot4) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot5 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot5,PlayerName2(Slot5),GetPlayerMoney(Slot5) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot6 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot6,PlayerName2(Slot6),GetPlayerMoney(Slot6) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot7 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot7,PlayerName2(Slot7),GetPlayerMoney(Slot7) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot8 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot8,PlayerName2(Slot8),GetPlayerMoney(Slot8) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot9 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot9,PlayerName2(Slot9),GetPlayerMoney(Slot9) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        if(
Slot10 != -1)    {
            
format(stringsizeof(string), "(%d) %s - $%d"Slot10,PlayerName2(Slot10),GetPlayerMoney(Slot10) );
            
SendClientMessage(playerid,COLOR_WHITE,string);
        }
        return 
1;
}

PlayerName2(playerid) {
  new 
pname[MAX_PLAYER_NAME];
  
GetPlayerName(playeridpnamesizeof(pname));
  return 
pname;

jlalt is offline   Reply With Quote
Old 31/08/2015, 11:15 PM   #3
kyriakos587
Huge Clucker
 
kyriakos587's Avatar
 
Join Date: Sep 2012
Posts: 276
Reputation: 15
Default Re: Rich list Help

Ok will try and i will tell you
__________________
Tutorials
None

FilterScript
Song System
AntiSpawn System
CoolAdmin Version

Current Project
Ultimate Gaming Freeroam(5%)
kyriakos587 is offline   Reply With Quote
Old 31/08/2015, 11:17 PM   #4
blackgangs
Banned
 
Join Date: Mar 2014
Location: cairo,egypt
Posts: 82
Reputation: 7
Default Re: Rich list Help

nice
blackgangs is offline   Reply With Quote
Old 31/08/2015, 11:23 PM   #5
kyriakos587
Huge Clucker
 
kyriakos587's Avatar
 
Join Date: Sep 2012
Posts: 276
Reputation: 15
Default Re: Rich list Help

Work Perfect!!!
__________________
Tutorials
None

FilterScript
Song System
AntiSpawn System
CoolAdmin Version

Current Project
Ultimate Gaming Freeroam(5%)
kyriakos587 is offline   Reply With Quote
Old 31/08/2015, 11:24 PM   #6
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,277
Reputation: 366
Default Re: Rich list Help

Quote:
Originally Posted by kyriakos587 View Post
Work Perfect!!!
dont miss bottom
jlalt is offline   Reply With Quote
Old 31/08/2015, 11:27 PM   #7
kyriakos587
Huge Clucker
 
kyriakos587's Avatar
 
Join Date: Sep 2012
Posts: 276
Reputation: 15
Default Re: Rich list Help

i already do
__________________
Tutorials
None

FilterScript
Song System
AntiSpawn System
CoolAdmin Version

Current Project
Ultimate Gaming Freeroam(5%)
kyriakos587 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anyone been thinking about how to become rich? Cypress Everything and Nothing 87 30/07/2013 10:18 AM
Ever heard of Global Rich List? Mr.Anonymous Everything and Nothing 37 25/04/2013 01:08 PM
Help!! Bank Rich list martini002 Help Archive 0 27/03/2011 09:13 PM
[GameMode] [GM] Rich VS Poor: V2.1 meegan1 Gamemode Scripts 10 21/07/2009 02:14 PM


All times are GMT. The time now is 12:05 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.