Raised This Month: $ Target: $400
 0% 

Question about order


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
StrikerM
BANNED
Join Date: Nov 2019
Old 10-19-2021 , 22:16   Question about order
Reply With Quote #1

Hello.

I want to make a /rank cmd that shows in console first 10 people with the biggest points.
I am with another friend and he has 10 points i have 15, it shows me 2 times instead of both of us.

Code:
public test(id)
{
	new string[300];
	Data[0] = id;
	format(string, charsmax(string), "SELECT * FROM `players` ORDER BY `Points` DESC LIMIT 10"), SQL_ThreadQuery(Handler, "GiveRankInformation", string, Data, 5);
	return PLUGIN_HANDLED;
}

new PlayerName2[32], PlayerPoints[32];
public GiveRankInformation(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
	new id = Data[0];
	if(SQL_NumResults(Query) > 0) 
	{
		id++;
		SQL_ReadResult(Query, 1, PlayerName2[id], 32), PlayerPoints[id] = SQL_ReadResult(Query, 5);
		new Players[32], iNum, id2;
	   	get_players(Players, iNum, "ch");
		for(new i = 0; i < id; i++) 
		{
			id2 = Players[i];
			client_print(id2, print_console, "%s %s - Points: %d - %d", TAG, PlayerName2[id], PlayerPoints[id], id);
		}
	}
	return PLUGIN_HANDLED;
}
StrikerM is offline
 



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

Forum Jump


All times are GMT -4. The time now is 11:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode