SA-MP Forums Archive
y_hooks collision - 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: y_hooks collision (/showthread.php?tid=564733)



y_hooks collision (Solved) - DRIFT_HUNTER - 22.02.2015

Includes and their order
pawn Код:
#include <a_samp>
    #undef MAX_PLAYERS
    #define MAX_PLAYERS     30      //Server Slots

#include <sscanf2>
#include <zcmd>
#include <YSI\y_iterate>
#include <YSI\y_va>
#include <YSI\y_hooks>
//#include <a_mysql>
#include <streamer>
#include <easyDialog>

//After few defines and variables
#include "TDM/TeamBalancer.pwn"
#include "TDM/TeamInfo.pwn"
Both files have same hook method like these, and return 1 at the end
pawn Код:
hook Test:OnPlayerRequestClass(playerid, classid)
{
    return 1;
}
Error:
pawn Код:
TDM/TeamChoser.pwn(40) : error 021: symbol already defined: "@yH_PlayerRequestClass1"
TDM/TeamChoser.pwn(41) : error 021: symbol already defined: "@yH_PlayerRequestClass1"
As error say its a function collision (same name). So what im doing wrong with hooks? (I know its me , i just cant find in documentation what it is)

EDIT: Problem solved.

I solved these by digging into y_hooks include topic. In case someone has same problem here is the problem.

We need to use:
pawn Код:
Hook:one_OnPlayerRequestClass(playerid, classid)
Please notice H is uppercase and that one_ is actually a prefix (you can name it whatever you want)

Or (I will quote ****** answer on same problem)
Quote:
Originally Posted by ******
Посмотреть сообщение
s0up: If you don't use the prefix version of the choose, you need to re-include y_hooks before every duplicate hook.



Re: y_hooks collision - 1fret - 22.02.2015

sorry phone malfunctiond

i think that error is because u define that function twice in your script so delete 1


Re: y_hooks collision - DRIFT_HUNTER - 22.02.2015

Well i see that...and i also know its caused by y_hooks (actually me using it wrongly as nobody complained before). My only question is what im doing wrong?

EDIT: problem solved, if you have same problem fix is in first post.