Hooking functions - 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: Hooking functions (
/showthread.php?tid=567061)
Hooking functions -
SeYziicH - 10.03.2015
Код:
// [GivePlayerMoney Hook]
#if defined _ALS_GivePlayerMoney
#undef GivePlayerMoney
#else
#define _ALS_GivePlayerMoney
#endif
#define GivePlayerMoney GivePlayerMoneyEx
stock GivePlayerMoneyEx(playerid, money)
{
Anticheat[playerid][Money] += money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Anticheat[playerid][Money]);
return GivePlayerMoney(playerid, Anticheat[playerid][Money]);
}
When i add that include to bare script and use simple command:
Код:
if(strcmp(cmd, "/a", true) == 0) {
GivePlayerMoney(playerid, 200);
return 1;
}
I am getting error of "Unknown command" what is wrong here...?
Re: Hooking functions -
Abagail - 10.03.2015
The hook is supposed to be after the redefinition. Additionally, try using ZCMD - it's faster and more efficient.
Re: Hooking functions -
SeYziicH - 10.03.2015
Quote:
Originally Posted by Abagail
The hook is supposed to be after the redefinition. Additionally, try using ZCMD - it's faster and more efficient.
|
Ohh.. problem solved thanks!