20.10.2011, 10:11
pawn Код:
command(gangs, playerid, params[])
{
new tGid[5], tGname[100], tGOwner[25], Query[200], string[1000], DBResult:Result;
format(Query, sizeof(Query), "SELECT * FROM `GANGS` DESC limit 10");
Result = db_query(Database, Query);
for (new i; i < db_num_rows(Result); i++)
{
db_get_field(Result, 0, tGname, sizeof(tGname));
db_get_field(Result, 1, tGid, 5);
db_get_field(Result, 2, tGOwner, sizeof(tGOwner));
// db_get_field_assoc(Result, "NAME", tGname, sizeof(tGname));
// db_get_field_assoc(Result, "OWNER", tGOwner, sizeof(tGOwner));
// db_get_field_assoc(Result, "ID", tGid, 5);
format(string, sizeof(string), "%sID: %d Name: %s Owner: %s\r\n",string,strval(tGid), tGname, tGOwner);
db_next_row(Result);
}
ShowPlayerDialog(playerid, DIALOG_GANG_INFO, DIALOG_STYLE_LIST, "Gang War", string, "Info", "Cancel");
if(db_num_rows(Result) == 0) return ShowPlayerDialog(playerid, DIALOG_GANG_INFO, DIALOG_STYLE_LIST, "Gang War", "No gangs", "Info", "Cancel");
return 1;
}