Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Top en 2d

 
  • 0 Vote(s) - 0 Average
Pawn Top en 2d
Hitler
Offline

Burgershot Member
Posts: 19
Threads: 12
Joined: Feb 2021
Reputation: 0
#1
2021-02-23, 02:09 AM (This post was last modified: 2021-02-23, 02:28 PM by Hitler.)
Español: ya tengo una función que muestra a los 5 mejores top score, pero como lo hago para hacerlo en un texto 2d 

English: I already have a function that shows the top 5 scores, but how do I do it in a 2d text?

Code:
CMD:top(playerid)
{
mysql_pquery(con, "SELECT `Nombre`, `Score` FROM `usuarios` WHERE `Score` > 0 ORDER BY `Score` DESC LIMIT 5", "MejoresScore", "d", playerid);
return 1;
}

funcion MejoresScore(playerid)
{
new rows = cache_num_rows(),string[300],Escore,nameplayer[MAX_PLAYER_NAME];
if(rows > 0)
{
string = "{FFFFFF}Lista 5 mejores Scores\n\n";
for(new i=0; i<rows; i++)
{
cache_get_value_name_int(i, "Score", Escore);
cache_get_value_name(i, "Nombre", nameplayer, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s#%d\t%s  %d Score\n",string,i+1,nameplayer,Escore);
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Top Scores", string, "Cerrar", "");
}
return 1;
}

como así:  https://imgur.com/SO3F1Fj
Programador básico
destiezk
Offline

Burgershot Member
Posts: 41
Threads: 1
Joined: Feb 2021
Reputation: 3
Location: Hungary
#2
2021-02-23, 10:17 AM
what do you want to achieve, you didn't add english language.
Hitler
Offline

Burgershot Member
Posts: 19
Threads: 12
Joined: Feb 2021
Reputation: 0
#3
2021-02-23, 02:32 PM
(2021-02-23, 10:17 AM)destiezk Wrote: what do you want to achieve, you didn't add english language.

Fixed up, I already have a function that shows the top 5 scores, but how do I do it in a 2d text?
Programador básico
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#4
2021-02-23, 04:20 PM
(2021-02-23, 02:32 PM)Hitler Wrote:
(2021-02-23, 10:17 AM)destiezk Wrote: what do you want to achieve, you didn't add english language.

Fixed up, I already have a function that shows the top 5 scores, but how do I do it in a 2d text?
https://open.mp/docs/scripting/functions/SetObjectMaterialText
Hitler
Offline

Burgershot Member
Posts: 19
Threads: 12
Joined: Feb 2021
Reputation: 0
#5
2021-02-23, 06:36 PM
help

Code:
new objectId = CreateObject(19353,2214.05127,-57.67043, 28.17278,0.00000,0.00000,89.51998); // team 1.40
new pruebaa[300];

format(pruebaa, sizeof(pruebaa), "SELECT * FROM `usuarios` ORDER BY `Score` DESC LIMIT 3");

new rows = cache_num_rows(),Escore,prueba[50],nameplayer[MAX_PLAYER_NAME];

if(rows > 0)

{

prueba = "{FFFFFF}Lista 3 mejores Scores\n\n";

for(new i=0; i<rows; i++)

{

cache_get_value_name_int(i, "Score", Escore);

cache_get_value_name(i, "Nombre", nameplayer, MAX_PLAYER_NAME);

format(prueba, sizeof(prueba), "%s#%d\t%s  %d Score\n",prueba,i+1,nameplayer,Escore);

}

}
    SetObjectMaterialText(objectId, prueba, 0, OBJECT_MATERIAL_SIZE_256x128,"Arial", 28, 1, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
Programador básico
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#6
2021-02-23, 10:23 PM
PHP Code:
new objectId = CreateObject(19353, 2214.05127, -57.67043, 28.17278, 0.00000, 0.00000, 89.51998); // team 1.40
new pruebaa[300];

new 
Cache: result = mysql_query(MYSQL_DEFAULT_HANDLE, "SELECT * FROM `usuarios` ORDER BY `Score` DESC LIMIT 3");

new 
rows = cache_num_rows(), Escore, prueba[50], nameplayer[MAX_PLAYER_NAME];

if (
rows)

{

prueba = "{FFFFFF}Lista 3 mejores Scores\n\n";

for (new 
i = 0; i < rows; i++)

{

cache_get_value_name_int(i, "Score", Escore);

cache_get_value_name(i, "Nombre", nameplayer, MAX_PLAYER_NAME);

format(prueba, sizeof(prueba), "%s#%d\t%s  %d Score\n", prueba, i + 1, nameplayer, Escore);

}
cache_delete(result);

}
SetObjectMaterialText(objectId, prueba, 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", 28, 1, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); 
Hitler
Offline

Burgershot Member
Posts: 19
Threads: 12
Joined: Feb 2021
Reputation: 0
#7
2021-02-24, 12:19 AM (This post was last modified: 2021-02-24, 12:21 AM by Hitler.)
(2021-02-23, 10:23 PM)Radical Wrote:
PHP Code:
new objectId = CreateObject(19353, 2214.05127, -57.67043, 28.17278, 0.00000, 0.00000, 89.51998); // team 1.40
new pruebaa[300];

new 
Cache: result = mysql_query(MYSQL_DEFAULT_HANDLE, "SELECT * FROM `usuarios` ORDER BY `Score` DESC LIMIT 3");

new 
rows = cache_num_rows(), Escore, prueba[50], nameplayer[MAX_PLAYER_NAME];

if (
rows)

{

prueba = "{FFFFFF}Lista 3 mejores Scores\n\n";

for (new 
i = 0; i < rows; i++)

{

cache_get_value_name_int(i, "Score", Escore);

cache_get_value_name(i, "Nombre", nameplayer, MAX_PLAYER_NAME);

format(prueba, sizeof(prueba), "%s#%d\t%s  %d Score\n", prueba, i + 1, nameplayer, Escore);

}
cache_delete(result);

}
SetObjectMaterialText(objectId, prueba, 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", 28, 1, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); 


Gracias
Programador básico
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode