Open PT-Player opened 9 years ago
Maybe, I remember writing some code to hook the normal calls, and y_dialog IDs and dialog IDs are actually independent anyway so should be fine. y_dialogs creates a normal dialog and saves its returned ID for later use.
So if i use y_dialogs and normal dialogs together this dont gone be reason for the dialogs created by y_dialogs dont execute the "response"?
WOW i got an problem using y_dialogs and normal dialogs togheter.
If i have y_dialogs defined on gamemode with normal dialogs, the normal dialogs stop respond, like the dialog is show but the response is not called...
Any idea how to fix this? To use both?
Why would you need to use both though, other than other libraries using it? They aren't required to be inline so you can work them just like YCMD/ZCMD.
Because i have an old server with i'm reopening, In 2013 when i closed i only was using y_cmds and y_ini.
Now at 2015 im using more of the YSI so i have alot dialogs on server and new system's use y_dialogs, so one day i will convert all to y_dialogs but now i would like use both..
@Y-Less any idea?
https://github.com/Misiur/YSI-Includes/blob/YSI.tl/YSI_Visual/y_dialog.inc#L362-L382 If this is uncommented, It should do it but why is it commented ?
Also, In _ShowPlayerDialog
stock, The ShowPlayerDialog
function call should've been Dialog_Show
and also there should be a Dialog_Set
call to set the dialog to be the current AFAK.
I am not on PC right now but will see if I can fix it when I am on it.
i think the fact that you can see the code is wrong explains WHY it was commented out. Also, you need Dialog_Show
or Dialog_Set
, not both, since one does the other.
@Y-Less i need to use normal dialogs ShowPlayerDialog and y_dialogs + y_inline.
However when i define the include y_dialogs, normal dialogs stop response... It's not possible use both?
I think JohnyMac is correct - check out that commented redefinition of ShowPlayerDialog.
@Y-Less can i take out the comment and use it normally?
You developed it so i ask you, it's safe use it?
@ edit
i used and didnt worked...
I'm guessing that it was commented for a reason, I have just forgotten what that reason was. Also, read the rest of JohnyMac's post - I do think he nailed it.
@Y-Less i think i will wait for the fix of @JohnyMac.
I didn't understand what he said.
stock _ShowPlayerDialog(playerid, dialog, style, string:title[], string:caption[], string:button1[], string:button2[])
{
Dialog_TryObtainID(dialog);
YSI_g_sDialogInfo[dialog][E_CALLBACK_DATA_POINTER] = 0;
Dialog_Show(playerid, style, title, caption, button1, button2, dialog);
return 0;
}
It's that simple. Do that then un-comment it. Not tested, but if JohnyMac nailed it as well as Y-Less said that should work.
@Y-Less That was stupid of me :P
@Crayder I actually just tested that out and you need to remove YSI_g_sDialogInfo[dialog][E_CALLBACK_DATA_POINTER] = 0;
because it creates an error, I don't know why but I noticed that all instances of that are commented through out the code, @Y-Less ?
So the final code will be:
stock _ShowPlayerDialog(playerid, dialog, style, string:title[], string:caption[], string:button1[], string:button2[])
{
Dialog_TryObtainID(dialog);
Dialog_Show(playerid, style, title, caption, button1, button2, dialog);
return 0;
}
And also here the code I used for testing:
#include <a_samp>
#include <YSI_Visual\y_dialog>
main() {}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ydialog", cmdtext, true, 10) == 0)
{
inline Response(pid, dialogid, response, listitem, string:inputtext[])
{
#pragma unused pid, dialogid, response, listitem, inputtext
SendClientMessage(playerid, 0xFF0000AA, "You clicked a button in y_inline!");
}
Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_MSGBOX, "Title", "This is y_inline + y_dialog.", "Button 1", "No");
return 1;
}
if (strcmp("/normal", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "HEY THERE", "This is normal dialog", "Yes", "No");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
SendClientMessage(playerid, 0xFF0000AA, "You clicked a button in normal ShowPlayerDialog!");
}
return 1;
}
Can i use normal dialogs ( https://wiki.sa-mp.com/wiki/ShowPlayerDialog ) and y_dialogs at same time?
It's possiblem make that? Or will bug the "id's"?