21.09.2018, 16:23
PHP код:
LoadPlayerBankCards(playerid)
{
new p_name_inside_f[MAX_PLAYER_NAME], Query[164], DBResult:GetPlayerBankCards, Dialog_String[226];
GetPlayerName(playerid, p_name_inside_f, sizeof(p_name_inside_f));
format(Query, sizeof(Query), "SELECT * FROM `bank-cards` WHERE `username` = '%s'", DB_Escape(p_name_inside_f));
format(Dialog_String, sizeof(Dialog_String), "\tBaratis Saxeli\tTanxa\n");
GetPlayerBankCards = db_query(Users, Query);
if(db_num_rows(GetPlayerBankCards))
{
for(new i; i<db_num_rows(GetPlayerBankCards); i++)
{
new card_name[64], card_cash, card_id, cards_info[64];
db_get_field_assoc(GetPlayerBankCards, "cardname", card_name, sizeof(card_name));
card_cash = db_get_field_assoc_int(GetPlayerBankCards, "cash");
card_id = db_get_field_assoc_int(GetPlayerBankCards, "id");
p_bank_card[playerid][p_bank_card_loaded[playerid]][cash] = card_cash;
p_bank_card[playerid][p_bank_card_loaded[playerid]][b_c_id] = card_id;
strcat(p_bank_card[playerid][p_bank_card_loaded[playerid]][name], card_name);
p_bank_card_loaded[playerid]++;
format(cards_info, sizeof(cards_info), "\t%s\t%d\n", card_name, card_cash);
strcat(Dialog_String, cards_info);
db_next_row(GetPlayerBankCards);
}
}
else
{
SendClientMessage(playerid, -1, "Tqven Ar Gaqvt Sabanko Baratebi!");
}
db_free_result(GetPlayerBankCards);
ShowPlayerDialog(playerid, 81, DIALOG_STYLE_TABLIST_HEADERS, "Sabanko Baratebi", Dialog_String, "Sworia", "Bugia");
return 1;
}