2021-02-27, 10:42 PM
(2021-02-27, 09:28 PM)Hitler Wrote:(2021-02-27, 09:10 PM)Virsenas Wrote:(2021-02-27, 09:05 PM)Hitler Wrote:(2021-02-27, 09:02 PM)Virsenas Wrote:Quote:the problem is that when I restart the server when a player kills another player, the team score returns to 1 and it is adding again
Sounds like a loading problem. Did you debug the loading? Did you check what it loads?
It loads well, the problem is when is added
Can you show the loading code?
Code:CMD:ranking(playerid)
{
mysql_pquery(con, "SELECT `Team`, `Score` FROM `Ranking` WHERE `Score` > 0 ORDER BY `Score` DESC LIMIT 4", "Rank", "d", playerid);
return 1;
}
funcion Rank(playerid)
{
new rows = cache_num_rows(), prueba[300], Escore, team[MAX_PLAYER_NAME];
if(rows > 0)
{
prueba = "{FFFFFF}Ranking Teams\n\n";
for (new i = 0; i < rows; i)
{
cache_get_value_name_int(i, "Score", Escore);
cache_get_value_name(i, "Team", team, MAX_PLAYER_NAME);
format(prueba, sizeof(prueba), "%s#%d %s? ? %d\n", prueba, i 1, team, Escore);
}
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_MSGBOX, "Ranking Teams", prueba, "Cerrar", "");
}
return 1;
}
Quote:It loads well, the problem is when is added
I would be surprised if the code even compiled. You just created that code with no real care just to make it look like you tried putting in effort. I wondered why it took you more than 10 minutes to copy and paste your loading code.
In order to make your ranking script you will need:
https://www.youtube.com/watch?v=kR3nRkbGmiA for information to hold (team names, player names, score etc.)
https://sampwiki.blast.hk/wiki/MySQL/R40 for loading and saving
https://open.mp/docs/scripting/functions/strcat for showing ranking information in a dialog
Good luck.