Explain me please OnDialogResponse -
universe - 07.12.2010
This is my code:
Quote:
#define D_Help 2
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 10) == 0)
{
ShowPlayerDialogHelpCommand(playerid);
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(D_Help)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You cancelled.");
return 1;
}
switch(listitem)
{
case 0: // Listitems start with 0, not 1
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "ROFLED");
return 1;
}
case 1:
{
}
case 2:
{
}
}
}
}
return 0;
}
ShowPlayerDialogHelpCommand(playerid)
{
ShowPlayerDialog(playerid, D_Help, DIALOG_STYLE_MSGBOX, "Help Box", "Here we gonna show you some basic command for the server.\n/command\n/command", "Accept", "Cancel");
return 1;
}
|
i wanna do a dialog with the command /help, there you get explained all command, and then if click accept there you will get a dropbox to select what command you want, also the function OnDialogResponse, i dont get it work
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
fuck! please answer need help
Re: Explain me please OnDialogResponse -
Toreno - 07.12.2010
First, this is your OnPlayerCommandText:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd,"/help",true) == 0)
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"List Dialog","1. Option1\r\n2. Option2\r\n3. Option3","Choose", "Cancel");
return 1;
}
return 1;
}
Now, here is what happen when you choose Option1 / Option2 / Option3 ...
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(1)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have cancelled!");
return 1;
}
switch(listitem)
{
case 0:
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have chosen Option1!");
}
case 1:
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have chosen Option2!");
}
case 2:
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have chosen Option3!");
}
}
}
}
return 0;
}
You can change Option1 / 2 / 3 ... to whatever option you want, it shows you the list,
then you need to modify it by OnDialogResponse by starting with case 0.
I hope it helps, If you need more help. talk with me...
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
Thank you, im trying to do a DM server in las venturas, if started like 4 days ago and i have already 300 lines, thanks, but it will be very basic ^^
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(41 ) : warning 217: loose indentation
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(87 ) : error 017: undefined symbol "ShowPlayerDialogOnConnect"
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(10 3) : error 017: undefined symbol "cmd"
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(11 5) : error 029: invalid expression, assumed zero
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(11 5) : warning 217: loose indentation
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(11 5) : error 004: function "OnDialogResponse" is not implemented
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(12 1) : error 017: undefined symbol "response"
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(12 6) : error 017: undefined symbol "listitem"
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(14 9) : warning 225: unreachable code
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(14 9) : error 017: undefined symbol "ShowPlayerDialogOnConnect"
C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(15 7) : error 030: compound statement not closed at the end of file (started at line 103)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
8 Errors.
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
Ok, i fixed the errors, but when i execute the command in the server, it appears the windows, but i click one option and i press choose and nothing happens
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
bump please answeer
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
pleaasee!
Re: Explain me please OnDialogResponse -
Toreno - 07.12.2010
Mhm... two questions,
Try double press on one of the options, and tell me what it does to you
and try to press on cancell, tell me what it does to you too
Re: Explain me please OnDialogResponse -
universe - 07.12.2010
cancel - > nothing, it closes only the dialog!