SA-MP Forums Archive
Include help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Include help (/showthread.php?tid=256269)



Include help - Unknown123 - 19.05.2011

test.inc
pawn Код:
#if defined _test
    #endinput
#endif
#define _test

#if !defined FILTERSCRIPT
public OnGameModeInit()
#else
public OnFilterScriptInit()
#endif
{
    print("rofl");
    return 1;
}

//OnGameModeInit
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif

//OnFilterScriptInit
#if defined _ALS_OnFilterScriptInit
    #undef OnFilterScriptInit
#else
    #define _ALS_OnFilterScriptInit
#endif

//OnGameModeInit
#define OnGameModeInit forward_OnGameModeInit
forward forward_OnGameModeInit();

//OnFilterScriptInit
#define OnFilterScriptInit forward_OnFilterScriptInit
forward forward_OnFilterScriptInit();
test.pwn
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <test>

public OnFilterScriptInit()
{
    print("OMG");
    print("OMG");
    print("OMG");
    print("OMG");
    print("OMG");
    print("OMG");
    print("OMG");
    return 1;
}
The problem is... "rofl" get printed but "OMG", "OMG".. ect... dont get printed

so why cant i use OnFilterScript in pawno but in the include?


Re: Include help - Bakr - 20.05.2011

Why are you making hooking much more complicated than it needs to be? ****** wrote a library exactly for this reason, check it out. It's part of his YSI library.

http://forum.sa-mp.com/showthread.ph...ghlight=y_hook


Re: Include help - Unknown123 - 20.05.2011

Y_Hooks make my server lagg... idk why

Thats why im doing it on the complicated way


Re: Include help - Bakr - 20.05.2011

You may be using it incorrectly, or your problem is something else. I've used the library multiple times flawlessly. You could also contact ****** if you are positive it is y_hooks causing your server to lag.


Re: Include help - Unknown123 - 20.05.2011

Im using it like this..

pawn Код:
#if defined _test
    #endinput
#endif
#define _test

#include <YSI\y_hooks>

#if !defined FILTERSCRIPT
Hook:Test_OnGameModeInit()
#else
Hook:Test_OnFilterScriptInit()
#endif
{
    print("rofl");
    return 1;
}
EDIT: thx, ill work it out..