[HELP] y_hook question.
#1

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.
Reply
#2

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> 
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)