Pablo_Escobarz 0 Posted February 1 Share Posted February 1 (edited) Hi guys! I'm using SAMP dialogs by adri1 I created the dialog, it shows up, but the function OnDialogResponse never gets called. A working example with the samp dialogs would be helpful. My code (clientside) public class Login : Events.Script { Dialog DIALOG_REGISTER; public Login() { Events.Add("CheckRegisterDialog", OnDialogResponse); Events.Add("ShowRegister", OnRequestDialog); } public void OnRequestDialog(object[] args) { switch ((int)args[0]) { case 4: DIALOG_REGISTER = new Dialog("DIALOG_REGISTER", "Server Register", "Your password:", new string[] { "Next", "Exit" }, null, null, " "); break; } } public void OnDialogResponse(object[] args) { /* args[0] = dialog_name args[1] = response args[2] = listitem args[3] = inputtext args[4] = inputpassword */ Chat.Output("dialog_name: " + args[0].ToString()); Chat.Output("response: " + (int)args[1]); Chat.Output("listitem: " + (int)args[2]); Chat.Output("inputtext: " + args[3].ToString()); Chat.Output("inputpassword: " + args[4].ToString()); DIALOG_REGISTER.Destroy(); } } This is how i trigger the events (serverside) NAPI.ClientEvent.TriggerClientEvent(player, "CheckRegisterDialog", 4); NAPI.ClientEvent.TriggerClientEvent(player, "ShowRegister", 4); 4 is the number of dialog password type. In the example Test.cs from adri1 an example of how to trigger the response event. Thanks! Edited February 1 by Pablo_Escobarz Link to post Share on other sites
Kopra 5 Posted February 1 Share Posted February 1 Maybe because it is for version 1.0, but you're using 1.1 I guess, your code looks fine. 1 Link to post Share on other sites
Pablo_Escobarz 0 Posted February 3 Author Share Posted February 3 For me it was the events name: Events.Add("CheckRegisterDialog", OnDialogResponse); Events.Add("ShowRegister", OnRequestDialog); to: Events.Add("dialog_response", OnDialogResponse); Events.Add("create_dialog", OnRequestDialog); It's fixed, thanks anyway. Link to post Share on other sites
Recommended Posts