hooking native function in a filterscript
#1

i was making a filterscript for a gamemode i needed to hook PlayerSpectatePlayer in the filterscript but it just doesnt work .. when i type /spec [id] (which is a command in the main gamemode) it doesnt print "hooking"

pawn Код:
// this is in filterscript
stock _ALT_PlayerSpectatePlayer(playerid, targetplayerid, mode = SPECTATE_MODE_NORMAL)
{
    print("hooking")
    specID[playerid] = targetplayerid;
    return PlayerSpectatePlayer(playerid, targetplayerid, mode);
}

#if defined _ALS_PlayerSpectatePlayer
    #undef PlayerSpectatePlayer
#else
    #define _ALS_PlayerSpectatePlayer
#endif
#define PlayerSpectatePlayer _ALT_PlayerSpectatePlayer
please note that i dont have the source code of the main gamemode thats why i use a filterscript
Reply
#2

You can't hook a function in a filterscript because defines don't apply cross-script whereas includes are actual addons to the gamemode, not a separate script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)