Need some help with dialog -
Breilid - 17.11.2012
Hey
I have just started with trying to make some dialogs, never done it before.
And my problem is nothing happens when i open the dialog in the game and click on something.
It just jump out of the dialog
I tried to look for some help on the web and on tutorials, but nothing helped.
I maid two different script, to see if it worked. But still the same problem.
I hope someone could help me whit this
Script 1:
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#define DIALOG_HCPANEL 0
#define DIALOG_COMMANDS 1
#define COLOR_RED 0xFF0000AA
CMD:hcpanel(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_HCPANEL, DIALOG_STYLE_LIST, "Help And Commands", "Commands\nHelp\nTele\nCredits", "Select", "Close");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HCPANEL)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 1)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 2)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 3)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
return 1;
}
}
return 1;
}
Script 2:
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#define DIALOG_HCPANEL 0
#define COLOR_RED 0xFF0000AA
CMD:hcpanel(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_HCPANEL, DIALOG_STYLE_LIST, "Help And Commands", "Commands\nHelp\nTele\nCredits", "Select", "Close");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HCPANEL)
{
switch(listitem) // Switching between items in the dialog list - Currently, only 3 items
{
case 0: GivePlayerWeapon(playerid,33,99999);
case 1: GivePlayerWeapon(playerid,33,99999);
case 2: GivePlayerWeapon(playerid,33,99999);
}
}
return 1;
}
Re: Need some help with dialog -
Dovydux - 17.11.2012
try to change DialogID to numbers
Re: Need some help with dialog -
Breilid - 17.11.2012
Still the same by changing to numbers
Re: Need some help with dialog -
Dovydux - 17.11.2012
Код:
if (dialogid == 8564)
{
if (response)
{
switch (listitem)
{
case 0:
{
SetPlayerColor(playerid, COLOR_RED );
SendClientMessage(playerid, COLOR_WHITE,"Tavo spalva Raudona");
}
case 1:
{
SetPlayerColor(playerid, COLOR_YELLOW );
SendClientMessage(playerid, COLOR_WHITE,"Tavo spalva geltona");
}
case 2:
{
SetPlayerColor(playerid, COLOR_GREEN );
SendClientMessage(playerid,COLOR_WHITE,"Tavo spalva юalia");
}
case 3:
{
SetPlayerColor(playerid, COLOR_BLUE);
SendClientMessage(playerid, COLOR_WHITE,"Tavo spalva mлlyna");
}
}
}
}
a working dialogresponse with case It's from my gamemode script
and back yours 1st script
Код:
if(dialogid == 2109) //dialog id
{
if(response) // pressed OK
{
if(listitem == 0) //1st choice
{
FUNCTION
}
else if(listitem == 1) //second choice
{
FUNCTION
}
if(listitem == 2) // third choice
FUNCTION
}
return 1;
}
both of these scripts work for me
Re: Need some help with dialog -
Konstantinos - 17.11.2012
The problem is that you're using it as a Filterscript and you returned true at the end of the callback. It should be
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_HCPANEL)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 1)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 2)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
if(listitem == 3)
{
GivePlayerWeapon(playerid,33,99999);
SendClientMessage(playerid, 0xFFFFFFFF, "message");
}
return 1;
}
}
return 0;
}
Re: Need some help with dialog -
Breilid - 19.11.2012
Thanks for all help! I just placed the hole script in to the gamemode, and it worked