Hook - 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: Hook (
/showthread.php?tid=402872)
Hook -
dr.lozer - 28.12.2012
Is this correct
pawn Код:
new OldScore[MAX_PLAYERS];
stock SetPlayerScoreEx(playerid, score)
{
OldScore[playerid] = GetPlayerScore(playerid);
return SetPlayerScore(playerid, score);
}
#if defined _ALS_SetPlayerScore
#undef SetPlayerScore
#else
#define _ALS_SetPlayerScore
#endif
#define SetPlayerScore SetPlayerScoreEx
Re: Hook -
Kreatyve - 28.12.2012
Yes, why didn't you test it yourself?
Re: Hook -
dr.lozer - 28.12.2012
im not on my pc!
im on my GF's PC :P
Re: Hook -
Kreatyve - 28.12.2012
Oh okay, been there done that. lol
Here's how you hook a callback also:
pawn Код:
public OnGameModeInit() {
return CallLocalFunction("OnGameModeInitEx", "");
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit OnGameModeInitEx
forward OnGameModeInitEx();
Then in gamemode.pwn:
pawn Код:
public OnGameModeInit() {
return true;
}
Re: Hook -
dr.lozer - 28.12.2012
My GF's PC dont have any pawno and Gta san MP :P
BTW i meant to hook the function not the publics or something else