Jump to content
RAGE Multiplayer Community

SAMP Dialogs response problem


Recommended Posts

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 by Pablo_Escobarz
Link to post
Share on other sites

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
  • Xabi locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...