Raised This Month: $30 Target: $400
 7% 

How to convert 1 to 01, 2 to 02, 3 to 03, and so on


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
papel
Junior Member
Join Date: Jul 2017
Old 08-12-2020 , 02:58   How to convert 1 to 01, 2 to 02, 3 to 03, and so on
Reply With Quote #1

Hi everybody. How are you?
I have a classification plugin and I would like to know how to convert the numbers from 1 - 9 to 01, 02 ... 09, 10. That is, keep the order of the classification numbering to two decimal places.

Example:
1- to 01- 1000 pts - Jules
2- to 02- 800 pts - Jack
3- to 03- 500 pts - Victor
.
.
10 do not change 10- 100 pts - Sanches

Could you help me, please?

Code:
public SQLQueryTop10(Handle:owner, Handle:hndl, const String:error[], any:data) {
	new client;
	if((client = GetClientOfUserId(data))==0) {
		return;
	}
	if(hndl==INVALID_HANDLE) {
		LogError("Query failed: %s", error);
	} else {
		decl String:qname[64], String:qrating[8], String:buffer[68];
		new i = 0;
		new num = 1;
		new Handle:panel = CreatePanel();
		SetPanelTitle(panel, "Top 10 players:");
		while(SQL_FetchRow(hndl)) {
			SQL_FetchString(hndl, 0, qname, sizeof(qname));
			SQL_FetchString(hndl, 1, qrating, sizeof(qrating));
			Format(buffer, sizeof(buffer), "%i. %s pts - %s",num, qrating, qname);
			num++;
			DrawPanelText(panel, buffer);
			i++;
		}
		DrawPanelItem(panel, "Close");
		SendPanelToClient(panel, client, PanelHandlerNothing, 15);
		CloseHandle(panel);
	}
}

Last edited by papel; 08-12-2020 at 03:16.
papel is offline
CrazyHackGUT
AlliedModders Donor
Join Date: Feb 2016
Location: Izhevsk, Russia
Old 08-12-2020 , 03:29   Re: How to convert 1 to 01, 2 to 02, 3 to 03, and so on
Reply With Quote #2

Code:
Format(buffer, sizeof(buffer), "%02i. %s pts - %s",num, qrating, qname);
__________________
My english is very bad. I am live in Russia. Learning english language - very hard task for me...

Last edited by CrazyHackGUT; 08-12-2020 at 03:30.
CrazyHackGUT is offline
Send a message via ICQ to CrazyHackGUT Send a message via Skype™ to CrazyHackGUT
papel
Junior Member
Join Date: Jul 2017
Old 08-12-2020 , 04:12   Re: How to convert 1 to 01, 2 to 02, 3 to 03, and so on
Reply With Quote #3

It worked!!!!!
Thank you my friend.
Have a great day!
papel is offline
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

Forum Jump


All times are GMT -4. The time now is 05:02.


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