22.08.2016, 19:35
(
Последний раз редактировалось sampkinq; 23.08.2016 в 09:42.
)
Hi, I'm looking for a money system top for MySQL. Can you help ?
SELECT column_money FROM user_table ORDER BY column_money DESC
CMD:showtop(playerid) { new Cache:Result, Name[24], Money, fString[128], cString[600]; Result = mysql_query(dbhandle, "SELECT column_money FROM user_table ORDER BY column_money DESC LIMIT 10"); if(cache_num_rows()) { for(new i = 0; i < cache_num_rows(); ++ i) { cache_get_field_content(i, "Column Name", Name); Money = cache_get_field_content_int(i, "Column Money"); format(fString, sizeof fString, "Name: %s | Money: $%d,00\n", Name, Money); strcat(cString, fString); } } cache_delete(Result); ShowPlayerDialog(playerid, 555, DIALOG_STYLE_MSGBOX, "MONEY RANK", cString, "OK",""); return true; }
Try...
Код:
CMD:showtop(playerid) { new Cache:Result, Name[24], Money, fString[128], cString[600]; Result = mysql_query(dbhandle, "SELECT column_money FROM user_table ORDER BY column_money DESC LIMIT 10"); if(cache_num_rows()) { for(new i = 0; i < cache_num_rows(); ++ i) { cache_get_field_content(i, "Column Name", Name); Money = cache_get_field_content_int(i, "Column Money"); format(fString, sizeof fString, "Name: %s | Money: $%d,00\n", Name, Money); strcat(cString, fString); } } cache_delete(Result); ShowPlayerDialog(playerid, 555, DIALOG_STYLE_MSGBOX, "MONEY RANK", cString, "OK",""); return true; } |
warning 219: local variable "Name" shadows a variable at a preceding level error 035: argument type mismatch (argument 3) warning 204: symbol is assigned a value that is never used: "Name" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. CMD:showtop(playerid) { new Cache:Result, Name[24], Money, fString[128], cString[600]; Result = mysql_query(g_SQL, "SELECT Para FROM oyuncudata ORDER BY Para DESC LIMIT 10"); if(cache_num_rows()) { for(new i = 0; i < cache_num_rows(); ++ i) { cache_get_field_content(i, "Isim", Name); // Error Money = cache_get_field_content_int(i, "Para"); format(fString, sizeof fString, "Kullanıcı: %s | Para: $%s\n", Name, convertNumber(Money)); strcat(cString, fString); } } cache_delete(Result); ShowPlayerDialog(playerid, 95959, DIALOG_STYLE_MSGBOX, "MONEY RANK", cString, "OK",""); return true;
SELECT Cash, Username FROM accounts ORDER BY Cash DESC LIMIT 1
stock GetTopMoney(rank)
{
new Cache:result = mysql_query(connectionHandle, "SELECT `column_money`, `column_name` FROM `table_users` ORDER BY `column_money` DESC");
new playername[24], money = cache_get_row_int(rank-1, 0);
cache_get_row(rank-1, 1, playername, 24);
cache_delete(result);
new string[24+12]; format(string, sizeof(string), "%s|%d", playername, money);
return string;
}
new money, name[24];
sscanf(GetTopMoney(1), "p<|>s[24]i", name, money);