Adding command to start dialog:
#1

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

	if(dialogid == 20320 && response)
    {
		switch(listitem)
		{
			case 0:
			{
			   ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Take a look at my other 44's", "9mm($1000)\nSilenced 9mm($2000)", "OMGYES", "NiggaNO!");
            }
        }
    }
    if (dialogid == 20321 && response)
    {
	   switch(listitem)
	   {
		  case 0:
		  {
		  if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFFFF, "Bro you broke");
		  GivePlayerWeapon(playerid, 22,100);
		  GivePlayerMoney(playerid, -1000);
		  SendClientMessage(playerid, 0xFFFFFFFF, "Let's kick some ass.");
		  }
		  case 1:
		  {
		  if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFFFFFFFF, "Bro you broke");
		  GivePlayerWeapon(playerid, 23, 100);
		  GivePlayerMoney(playerid, -2000);
		  SendClientMessage(playerid, 0xFFFFFFFF, "Kick some silenced ass");
		  }
      }
   }

	return 1;
}
If someone can show me how to add a command to start this dialog?
Reply
#2

Код:
ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
Reply
#3

Erm? Can you explain how do I add a command to SHOW the dialog?
Reply
#4

pawn Код:
ShowPlayerDialog(playerid,20320 , DIALOG_STYLE_LIST, "write here something","item1\nitem2", "Whatever", "Cancel");
Reply
#5

If you're using y_commands:
pawn Код:
YCMD:dialog(playerid, params[], help)
{
    ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
    return true;
}
If you're using ZCMD:
pawn Код:
CMD:dialog(playerid, params[])
{
    ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
    return true;
}
If you're using strcmp:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/dialog"))
    {
        ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
        return true;
    }
    return false;
}
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply
#6

CMD:dialog(playerid, params[])
{
ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
return true;
}
When I add this at the very end it gives me this error:
C:\Users\MARKO\Desktop\Learning\gamemodes\Tutorial .pwn(44) : error 017: undefined symbol "dialogid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
HelP!
Reply
#7

When you make a dialog you can either give it a name or a number(dialogid).

If you give it a name you'll have to define it ontop of your script with this:

pawn Код:
#define DIALOG_NAME 1777 //The name in this case is DIALOG_NAME and the dialogid is 1777 both can be changed
pawn Код:
ShowPlayerDialog(playerid, DIALOG_NAME, DIALOG_STYLE_MSGBOX, "Hi", "Look at your dialog", "Close", "");
Replace dialogid with the name.

If you use a number, just replace dialogid with the number you want.

pawn Код:
ShowPlayerDialog(playerid, 1777, DIALOG_STYLE_MSGBOX, "Hi", "Look at your dialog", "Close", "");

I recommend you to read these wiki pages about dialogs.
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/Dialog_Styles
Reply
#8

Quote:
Originally Posted by Bek_Loking
Посмотреть сообщение
CMD:dialog(playerid, params[])
{
ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
return true;
}
When I add this at the very end it gives me this error:
C:\Users\MARKO\Desktop\Learning\gamemodes\Tutorial .pwn(44) : error 017: undefined symbol "dialogid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
HelP!
You're supposed to replace those parameters with what you require.

I.E.
Код:
ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Example Dialog", "Option #1\nOption #2\nOption #3", "Select", "Cancel");
Reply
#9

pawn Код:
CMD:dialog(playerid, params[])
{
    new string[128];
    format(string, sizeof (string), "Let's kick some ass\nKick some silenced ass");
    ShowPlayerDialog(playerid, 20321 ,DIALOG_STYLE_LIST, "Title", string, "Choose", "Cancel");
    return 1;
}
Reply
#10

I know, I misstyped, I got a warning****
Warning is: loose indentation line 27

NVM. I just had to move the return 1; in the line with ShowPlayerDialog
It was like this

ShowPlayerDialog(')
return 1;
i fixed it by:
ShowPlayerDialog()
return 1;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)