![]() |
[Pawn] symbol already defined: "@yH_OnScriptInit@003" - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] symbol already defined: "@yH_OnScriptInit@003" (/showthread.php?tid=1124) |
symbol already defined: "@yH_OnScriptInit@003" - Zow - 2020-06-24 I tried to hook OnScriptInit Here my main.pwn Code: #include <a_samp> test.pwn Code: #include <YSI_Coding/y_hooks> test1.pwn Code: #include <YSI_Coding/y_hooks> F:\samp\gamemodes\test1.pwn:4 (error) symbol already defined: "@yH_OnScriptInit@003" Install by sampctl package install pawn-lang/[email protected] RE: symbol already defined: "@yH_OnScriptInit@003" - JustMichael - 2020-06-24 Everytime you hook a callback using the `hook` macro, the final name of the callback becomes `hook <callback>@<unique_id>`. Now everytime you include `y_hooks` it generates a new unique number to append to the final callback name. Now as you might be aware, you can not have callbacks/functions of the same name, this doesn't compile. Now this is what is happening with your issue, you have included `y_hooks` and have hooked the same callback twice, without including `y_hooks` again after the first hook. So the unique generated ID, is the same for each hook, which is why it is not working here. So to fix this issue, include `y_hooks` before you hook the next callback. So this code below is bad. Code: #include <YSI_Coding\y_hooks> This is the fixed version that allows you to hook the same callback again Code: #include <YSI_Coding\y_hooks> |