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);
}
}