05.01.2019, 12:15
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_SELECT_CHARACTER_RP:
{
if(!response) return 1;
playerMakingCharacter[playerid] = true;
playerCharacterStep[playerid] = 1;
return 1;
}
else
{
new string[128], thread[128];
TogglePlayerSpectating(playerid, true);
playerMakingCharacter[playerid] = false;
playerCharacterStep[playerid] = 0;
SetPlayerName(playerid, CharacterLister[playerid][listitem]);
mysql_format(g_SQL, thread, sizeof(thread), "SELECT * FROM rp_characters WHERE char_Name = '%e' LIMIT 1", CharacterLister[playerid][listitem]);
mysql_tquery(g_SQL, thread, "Query_SelectCharacter", "i", playerid);
}
}
return 1;
}
forward Query_SelectCharacter(playerid);
public Query_SelectCharacter(playerid)
{
if (!cache_num_rows())
{
new
liststring[128]
;
for (new i = 0; i < 3; i ++) {
format(liststring, sizeof(liststring), "%s%s\n", liststring, CharacterLister[playerid][i]); }
return ShowPlayerDialog(playerid, DIALOG_SELECT_CHARACTER_RP, DIALOG_STYLE_LIST, "Nhan vat:", liststring, "Chon", "Tro lai");
}
new rows, fields, thread[128];
cache_get_row_count(rows);
cache_get_field_count(fields);
if(rows)
{
mysql_format(g_SQL, thread, sizeof(thread), "SELECT * FROM rp_characters WHERE char_Name = '%e'", GetPlayerNameEx(playerid));
mysql_tquery(g_SQL, thread, "Query_LoadCharacter", "i", playerid);
}
return 1;
}