SA-MP Forums Archive
Dialog,Help me - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog,Help me (/showthread.php?tid=607073)



Dialog,Help me - Savana221 - 14.05.2016

Good Morning , I have a problem with dialogue , everything I did as a wiki , and not working ..

So I did the dialogue that when he chooses the direction of the school that he throws a message to congratulate blah blah blah , but when I click OK , do not throw me a message already put me on admin duty , why ?? a dialogue in filterscript ..

Код:
enum
{
    DIALOG_SREDNJA,
    DIALOG_FAX,
}
Код:
public OnPlayerCommandText(playerid, cmdtext[])

if(strcmp(cmdtext, "/flesson", true, 6) == 0)
	{
		ShowPlayerDialog(playerid, DIALOG_FAX, DIALOG_STYLE_LIST, "select direction","Electric\nComputer\nMedical","OK","End");
		return 1;
	}
	if(strcmp(cmdtext, "/slesson", true, 6) == 0)
	{
		ShowPlayerDialog(playerid, DIALOG_SREDNJA, DIALOG_STYLE_LIST, "select direction","Electric\nComputer\nGymnasium\nMedical","OK","End");
		return 1;
	}
	return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_FAX)
    {
        if(response) 
        {
            SendClientMessage(playerid, 0x33AA33AA, "You have chosen the right direction , teaching begins!");
        }
        else 
        {
            Kick(playerid);
        }
        return 1; 
    }
    if(dialogid == DIALOG_SREDNJA)
    {
        if(response)
        {
            SendClientMessage(playerid, 0x33AA33AA, "You have chosen the right direction , teaching begins!");
        }
        else
        {
            Kick(playerid);
        }
        return 1;
    }
	return 0;
}



Re: Dialog,Help me - Recardo - 14.05.2016

try

PHP код:
#define DIALOG_FAX #define DIALOG_SREDNJA 



Re: Dialog,Help me - oMa37 - 14.05.2016

You didn't make the cases inside OnDialogResponse, Since you're making the dialog style "DIALOG_STYLE_LIST"


Re: Dialog,Help me - Savana221 - 14.05.2016

But I try and put this , the wiki to test , and again we come to the dialogue pasword ...


Код:
#define DIALOG_WEAPONS 3
 
// In some command
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\nAK-47\nCombat Shotgun", "Select", "Close");
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONS)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the weapon
            switch(listitem)
            {
                case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
                case 1: GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
                case 2: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}



Re: Dialog,Help me - oMa37 - 14.05.2016

Make sure the dialog id isn't the same as password dialog id


Re: Dialog,Help me - Logic_ - 14.05.2016

"Make sure the dialog id isn't the same as password dialog id" - Oma37_

"#define DIALOG_FAX #define DIALOG_SREDNJA" - Recardo

What a retarded reply from both of you
-----
PHP код:
enum
{
    
DIALOG_SREDNJA,
    
DIALOG_FAX // you added a comma here

follow the Savana's (your) reply, but don't use the "#define bla" for the dialogs, you will end up being f*cked if you use filterscripts in your server and they use the same define names or the same dialog id number, so use the code that i have posted above (enumerating the dialog ids).

EDIT: use switch for dialog ids and listitems in the dialogs.


Re: Dialog,Help me - oMa37 - 14.05.2016

Quote:

What a retarded reply from both of you

Still better than your dumb replies