SA-MP Forums Archive
hook function - 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 function (/showthread.php?tid=287732)



hook function - Tigerkiller - 04.10.2011

hi community.
i work on my anti cheat system
i know how to hook maybe OnPlayerConnect but idk how to hook maybe GivePlayerMoney.
Can anyone tell me how to hook maybe GivePlayerMoney ?


Re: hook function - aRoach - 04.10.2011

You can use y_hooks, and you can do this:
pawn Код:
stock TG_GivePlayerMoney( playeid, CASH )
{
    GivePlayerMoney( playerid, CASH );
    return YOUR_HOOK( );
}



Re: hook function - IstuntmanI - 04.10.2011

Put at the end of the include this:
Код:
#define GetPlayerMoney sGetPlayerMoney
#define GivePlayerMoney sGivePlayerMoney
#define ResetPlayerMoney sResetPlayerMoney
You can take a look on my Anti-Cheat.

@ aRoach: Fail.


Re: hook function - Tigerkiller - 04.10.2011

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Put at the end of the include this:
Код:
#define GetPlayerMoney sGetPlayerMoney
#define GivePlayerMoney sGivePlayerMoney
#define ResetPlayerMoney sResetPlayerMoney
You can take a look on my Anti-Cheat.

@ aRoach: Fail.
can you give me a link ?


Re: hook function - IstuntmanI - 04.10.2011

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
can you give me a link ?
https://sampforum.blast.hk/showthread.php?tid=284282


Re: hook function - Tigerkiller - 04.10.2011

i understand your inc
can you hook GivePlayerMoney and give me code ?


Re: hook function - System64 - 04.10.2011

y_hooks is the best


Re: hook function - Tigerkiller - 04.10.2011

so how to hook functions ? maybe GivePlayerMoney

for callbacks i allready use _ALS_


Re: hook function - wups - 04.10.2011

pawn Код:
stock Ex_GivePlayerMoney(...)
{
   // hello
   return GivePlayerMoney(...);
}
#define GivePlayerMoney Ex_GivePlayerMoney
Before all scripts, which use GivePlayerMoney. That's it!


Re: hook function - TheMaddox - 04.10.2011

Quote:
Originally Posted by wups
Посмотреть сообщение
pawn Код:
stock Ex_GivePlayerMoney(...)
{
   // hello
   return GivePlayerMoney(...);
}
#define GivePlayerMoney Ex_GivePlayerMoney
Before all scripts, which use GivePlayerMoney. That's it!
Thanks,i was checking out this topic,thanks a lot bro.