Raised This Month: $51 Target: $400
 12% 

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
papel
Junior Member
Join Date: Jul 2017
Old 08-12-2020 , 01: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 02:16.
papel 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 15:46.


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