SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 31/05/2020, 04:25 PM   #1
TheOliver
Big Clucker
 
Join Date: Apr 2020
Posts: 94
Reputation: 0
Default top player system

Hi, I want to make a system of top players with more scores, but I cannot find an operator or a way to verify that the highest variables, if you can help me, I would appreciate it very much, you do not know how much
TheOliver is offline   Reply With Quote
Old 31/05/2020, 05:40 PM   #2
SharpenBlade
Huge Clucker
 
Join Date: May 2020
Posts: 202
Reputation: 25
Default Re: top player system

You can select from your database the top 10 players in score:
PHP Code:
mysql_tquery(SQL"SELECT `Name`,`Score` FROM `users` ORDER BY `Score` DESC LIMIT 10""ShowTopScore""d"playerid ); //we interogate database to select the top 10 players and continue in function ShowTopScore 
PHP Code:
function ShowTopScoreplayerid )
{
    new 
RowsFieldsnameMAX_PLAYER_NAME ], scorestring[500]; // declaring the variables we are going to use
    
cache_get_row_count(Rows); // counting rows in the database
    
cache_get_field_count(Fields); // counting fields in the database

    
format(stringsizeof(string), "# Name\tScore\n"); // formating dialog header
    
for(new 0Rowsi++) // looping through rows
    
{
        
cache_get_value_name(i"Name"name24); // get the name from the database
        
cache_get_value_name_int(i"Score"score); // get the score form the database
        
format(stringsizeof(string), "%s%d %s\t%s\n"string1namescore); // adding those 2 in the string
    
}
    
ShowPlayerDialog(playeridyourdialogidDIALOG_STYLE_TABLIST_HEADERS"Top 10 score:"string"Ok"""); // showing the string
    
return 1;

Maybe something like this if you are using mysql.
SharpenBlade 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
Need PLayer Spawn System in LS Alexander1234 Scripting Help 5 22/08/2015 05:35 AM
Player Age System. Sledgehammer Scripting Help 0 14/06/2015 01:04 PM
House system and Player Keviin Scripting Help 3 04/05/2014 08:11 PM
[FilterScript] attachments system for player MORJAN1122 Filterscripts 0 23/11/2013 09:14 AM
[FilterScript] [FS] Player Color System - My first FS Youtube12 Filterscripts 15 11/04/2013 04:51 PM


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


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