![]() |
[Pawn] Very specific problem regarding file functions and y_hooks - 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] Very specific problem regarding file functions and y_hooks (/showthread.php?tid=815) |
Very specific problem regarding file functions and y_hooks - Plastikmensch - 2019-10-09 So... I don't really know if it is even script related or a bug with samp, y_hooks or sampctl. TL;DR: hook of CreateMenu doesn't get called when file functions (fwrite, fread etc..) are also hooked Problem description: Setup: 2 local Servers, only difference: server 1 uses sampctl, server 2 doesn't Exact same code: include file: Code: #include <a_samp> Code: #include <a_samp> Result server 1: nothing Result server 2: hook called When I delete (or comment out) the file hooks in server 1, it prints, but only then. It doesn't make any difference in server 2. So... can someone confirm this issue and/or has any solution or any idea why this happens? I'm out of ideas. Can provide more information if needed. (btw. are code tags broken when using formatting?) //Update: It works in server 1 when the CreateMenu hook is placed before the file hooks. Still don't know why this happens... But didn't test yet, if the file hooks are called when switched place. Will do more tests, after I finish the include, but seems like this isn't a scripting related problem. If someone wants to move this thread to the appropriate section, I'd be thankful. On a side note: if(handle) should be if(handle > 0). It's very unlikely a negative handle is passed by accident, but would still crash. //Update2: After adding some more hooks, CreateMenu wasn't called again. I commented out the hook right after it (in this case DestroyMenu) and it got called again. Oh, and tested file functions and none of them gets called. So... I still don't know why, but it seems it has nothing to do with the script or hooks itself. Also should add that I added a print to the gamemode in the meantime to print menuid and it is printing -2 now, which is very odd. //Update3: I give up. I can't find out why this happens. Creating a third server using sampctl, running code works, still not in server 1 (Again same code). Also it seems random which hook doesn't get called depending on where it's placed. Can be more precise, but I don't see the point anymore. Only assumption I can make is that it doesn't even matter what is hooked. Solved the return of -2: I returned the menuid of created menu and used "return ~menuid", remove "~" and it returns the correct value. |