21.01.2017, 10:29
Hi there, i've some trouble with OnDialogResponse and i can't understand why.
In game it show me the dialogs but when i click or press enter to select an item it doesn't do anything, like the conditions if(response) or !response aren't called.
In game it show me the dialogs but when i click or press enter to select an item it doesn't do anything, like the conditions if(response) or !response aren't called.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new str2[150]; format(str2, 150, "Arma\tMunizioni\tDisponibile\n\ Deagle\t9999\tN/D\n\ Shotgun\t9999\tN/D\n\ Mp5\t1000\t%d\n\ M4\t1000\t%d\n\ Sniper\t100\t%d\n", cwdisarmi[0], cwdisarmi[1], cwdisarmi[2]); if(dialogid == 5829) { if(response) { switch(listitem) { case 0: GivePlayerWeapon(playerid, 24, 9999); case 1: GivePlayerWeapon(playerid, 25, 9999); case 2: if(cwdisarmi[0] > 0) { GivePlayerWeapon(playerid, 28, 1000); cwdisarmi[0]--; SendClientMessage(playerid, -1, "a"); } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); case 3: if(cwdisarmi[1] > 0) { GivePlayerWeapon(playerid, 31, 1000); cwdisarmi[1]--; } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); case 4: if(cwdisarmi[2] > 0) { GivePlayerWeapon(playerid, 34, 100); cwdisarmi[1]--; } else ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); } return ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } else if(!response) return ShowPlayerDialog(playerid, 5829, DIALOG_STYLE_TABLIST_HEADERS, "Arma n 1", str2, "Vai", ""); } if(dialogid == 5830) { if(response) { switch(listitem) { case 0: if(GetPlayerWeapon(playerid) != 24) GivePlayerWeapon(playerid, 24, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 1: if(GetPlayerWeapon(playerid) != 25) GivePlayerWeapon(playerid, 25, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 2: if(GetPlayerWeapon(playerid) != 28) GivePlayerWeapon(playerid, 28, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 3: if(GetPlayerWeapon(playerid) != 31) GivePlayerWeapon(playerid, 31, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); case 4: if(GetPlayerWeapon(playerid) != 34) GivePlayerWeapon(playerid, 34, 9999), cwtimer[playerid][1] = 1; else ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } return 1; } else if(!response) return ShowPlayerDialog(playerid, 5830, DIALOG_STYLE_TABLIST_HEADERS, "Arma n° 2", str2, "Vai", ""); } return 0; // You MUST return 0 here! Just like OnPlayerCommandText. }