SA-MP Forums Archive
Create function Dialog: - 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: Create function Dialog: (/showthread.php?tid=632393)



Create function Dialog: - iDark - 13.04.2017

Hello,

I have a modular gamemode based on .inc files and I want to make a function like Dialog:dialogid(playerid, response, listitem, inputtext[]) to use it in every file without hooking OnDialogResponse everytime...

How can I do that function? I tried #define Dialog:%0(%1, %2, %3, %4) hook OnDialogResponse(%1, %0, %2, %3, %4) but is not working and gave my some errors.


Re: Create function Dialog: - GangstaSunny. - 13.04.2017

Make one .Inc file which hooks OnDialogResponse and include it in every other file :P


Re: Create function Dialog: - Meller - 13.04.2017

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Make one .Inc file which hooks OnDialogResponse and include it in every other file :P
Good idea to hook OnDialogResponse multiple times by including the same file in every other file.

Inb4 server lag.


Gut gemacht!


Re: Create function Dialog: - iDark - 13.04.2017

I get this errors when I try to define that function:

../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : warning 236: unknown parameter in substitution (incorrect #define pattern)
../gamemode/factions/main.inc(226) : error 010: invalid function or declaration
../gamemode/factions/main.inc(229) : error 010: invalid function or declaration

Код:
#define Dialog:%0(%1, %2, %3, %4) hook OnDialogResponse(%1, %0, %2, %3, %4)

#define DIALOG_TEST 123


CMD:test(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_TEST, DIALOG_STYLE_MSGBOX, "Is working?", "Yes or not?", "Yes", "No");
	return 1;
}

Dialog:DIALOG_TEST(playerid, response, listitem, inputtext[])
{
	if(!response) return SendClientMessage(playerid, COLOR_WHITE, "No");
	SendClientMessage(playerid, COLOR_WHITE, "Yes");
	return 1;
}