Hello! I want a TOP System. Example: Top 5 Rich. Please!
Post a screenshot of your accounts table
With my players registered on my server?
Quote from: Cool on Aug 02, 2017, 05:03 PMPost a screenshot of your accounts table
I hope you mean the DDL of the table structure and not the actual data in the table. If so, be more explicit because we'll enter a nasty discussion when he doesn't get it.
function TopMoney()
{
local query = QuerySQL(DataBase, "SELECT * FROM Account" ), aa=0;
local a,b,c,e,f,dem;
if ( !query )
{
MessagerServer(RED+"No Account");
}
else {
while ( GetSQLColumnData( query, 0 ) != null )
{
local m = GetSQLColumnData( query, 5 );
if ( m > f )
{
dem = GetSQLColumnData( query, 5 );
m = f;
f = dem;
}
if ( f > e )
{
dem = f;
f = e;
e = dem;
}
if ( e > c )
{
dem = e;
e = c;
c = dem;
}
if ( c > b )
{
dem = c;
c = b;
b = dem;
}
if ( b > a )
{
dem = b;
b = a;
a = dem;
}
(GetSQLNextRow( query ) && ((a > b) && (b > c) && (c > e) && (e > f)));
aa++;
}
local top1 = QuerySQL(DataBase, "SELECT * FROM Account WHERE Bank='"+a+"'" );
local top2 = QuerySQL(DataBase, "SELECT * FROM Account WHERE Bank='"+b+"'" );
local top3 = QuerySQL(DataBase, "SELECT * FROM Account WHERE Bank='"+c+"'" );
local top4 = QuerySQL(DataBase, "SELECT * FROM Account WHERE Bank='"+e+"'" );
local top5 = QuerySQL(DataBase, "SELECT * FROM Account WHERE Bank='"+f+"'" );
Message(RED+"[Top 1]: [ "+GetSQLColumnData( top1, 0 )+": ] "+COLOR_VERDE+ "Money: [ "+a+" ]$");
Message(RED+"[Top 2]: [ "+GetSQLColumnData( top2, 0 )+": ] "+COLOR_VERDE+ "Money: [ "+b+" ]$");
Message(RED+"[Top 3]: [ "+GetSQLColumnData( top3, 0 )+": ] "+COLOR_VERDE+ "Money: [ "+c+" ]$");
Message(RED+"[Top 4]: [ "+GetSQLColumnData( top4, 0 )+": ] "+COLOR_VERDE+ "Money: [ "+e+" ]$");
Message(RED+"[Top 5]: [ "+GetSQLColumnData( top5, 0 )+": ] "+COLOR_VERDE+ "Money: [ "+f+" ]$");
}
}
it is function
you can use it:
if ( cmd == "top" )
{
TopMoney();
}
looooooooooooooooooooool #RIP coding
Quote from: Cool on Aug 05, 2017, 06:18 PMlooooooooooooooooooooool #RIP coding
Why don't you script him the code than ? Although his coding style is lengthy and this function won't work for the topic starter. but he has helped him by providing complete idea of how top ranks can be set.
Btw,
@longhackmc , you could use SQL LIMIT function (https://www.w3schools.com/sql/sql_top.asp) instead of the long way method.
i tried but he did not gived me for what i asked SLC also explained
Quote from: . on Aug 02, 2017, 06:49 PMQuote from: Cool on Aug 02, 2017, 05:03 PMPost a screenshot of your accounts table
I hope you mean the DDL of the table structure and not the actual data in the table. If so, be more explicit because we'll enter a nasty discussion when he doesn't get it.
Quote from: Decent_946 on Aug 05, 2017, 10:17 PMQuote from: Cool on Aug 05, 2017, 06:18 PMlooooooooooooooooooooool #RIP coding
Why don't you script him the code than ? Although his coding style is lengthy and this function won't work for the topic starter. but he has helped him by providing complete idea of how top ranks can be set.
Btw, @longhackmc , you could use SQL LIMIT function (https://www.w3schools.com/sql/sql_top.asp) instead of the long way method.
Thanks and I will try.
I only know very little about programming C code too long.
hmm..
Can you give me specific example on how it works?
and GetSQLColumnData( top3, 0 ) is name of top 3.
Damn, TOP system for IniParser he meant then xd.
First of all, for IniParser, every player will need a unique number : like 1 for the first player that joined the server, 2 for the second player.
Then if the ids are saved correcty, you can make a function that looks like this:
function DoNotUseThis()
{
for (int i=0; ; i++)
{
local PlrName = ReadIniString("stats.ini","Playerids",i.tostring())
local PlrC = ReadIniString("stats.ini","Cash",PlrName);
//This is for getting the player's name from a ID, from the INI file 'stats'.
//Then you need to store the value you want in a array, then finnaly comparen them.
}
Im noob cuz' idk how to make arrays in squirrel, i never used them)
I'm sure that he uses IniParser, cuz' he stole my old server script.