[HELP] y_hook question. - 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: [HELP] y_hook question. (
/showthread.php?tid=643613)
[HELP] y_hook question. -
kingmk - 23.10.2017
It's possible to use hook more times to a same public in different includes?
Ex:
Structure files.
-gamemode.pwn
FolderSystems
-system_name1.inc
-system_name2.inc
In gamemode.pwn
Код:
#include <samp>
...
#include <YSI/y_hook>
...
#include <FolderSystems/system_name1>
#include <FolderSystems/system_name2>
...
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
...
In FolderSystems/system_name1.inc
Код:
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
//do something.
return 1;
}
In FolderSystems/system_name2.inc
Код:
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
//do something.
return 1;
}
And i got this error error 021: symbol already defined: "@yH_OnPlayerKeyStateChange@005" on system_name2.
This mean i can't use hook multiple times on a same public or I do something wrong?
How i should make my 'modular programming'... if hook don't work multiple times for a same public?
Should i make a function in system_name1, system_name2 and then calling on OnPlayerKeyStateChange in gamemode.pwn.
If i need do so, why i should use y_hook?
I have a big problema, anyone can explain me, ty.
I hope u undestood me.
Re: [HELP] y_hook question. -
Lokii - 23.10.2017
PHP код:
#include <YSI/y_hook>
#include <FolderSystems/system_name1>
#include <FolderSystems/system_name2>
to
PHP код:
#include <YSI/y_hook>
#include <FolderSystems/system_name1>
#include <YSI/y_hook>
#include <FolderSystems/system_name2>
Re: [HELP] y_hook question. -
kingmk - 23.10.2017
Quote:
Originally Posted by Lokii
PHP код:
#include <YSI/y_hook>
#include <FolderSystems/system_name1>
#include <FolderSystems/system_name2>
to
PHP код:
#include <YSI/y_hook>
#include <FolderSystems/system_name1>
#include <YSI/y_hook>
#include <FolderSystems/system_name2>
|
Ty dude, i just read that i don't need to include y_hook in every .inc and i did not try like this.
Solved, ty again.