14.07.2015, 01:52
PHP код:
// original: https://sampforum.blast.hk/showthread.ph...6.82159295
if(listitem == 1)
{
new query[80], Cache: weapons;
mysql_format(SQLHandle, query, sizeof(query), "SELECT WeaponID, Ammo FROM houseguns WHERE HouseID=%d ORDER BY WeaponID ASC", id);
weapons = mysql_query(SQLHandle, query);
new rows = cache_num_rows();
if(rows) {
new list[512], weapname[32];
format(list, sizeof(list), "#\tWeapon Name\tAmmo\n");
for(new i; i < rows; ++i)
{
GetWeaponName(cache_get_field_content_int(i, "WeaponID"), weapname, sizeof(weapname));
format(list, sizeof(list), "%s%d\t%s\t%s\n", list, i+1, weapname, convertNumber(cache_get_field_content_int(i, "Ammo")));
}
ShowPlayerDialog(playerid, DIALOG_HOUSE+10, DIALOG_STYLE_TABLIST_HEADERS, "House Guns", list, "Take", "Back");
}else{
SendClientMessage(playerid, 0xE74C3CFF, "You don't have any guns in your house.");
}
cache_delete(weapons);
}