Detect an used 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Detect an used function (
/showthread.php?tid=253225)
Detect an used function -
Biesmen - 05.05.2011
Hello,
I'm trying to find a method to detect if a function has been used. I already thought of one, but this one will undefine the original function.
e.g
pawn Код:
#define GivePlayerMoney GivePlayerMoneyEx
forward GivePlayerMoneyEx(playerid, money);
public GivePlayerMoneyEx(playerid, money)
{
return print("GivePlayerMoney has been used");
}
It will work, but it won't give the player the desired amount of money.
I hope you have an idea.
Re: Detect an used function -
Zh3r0 - 05.05.2011
Because you don't use GivePlayerMoney( money); inside GivePlayerMoneyEx.
All you have done is re-defining GivePlayerMoney to the Ex one, which in this case, Ex is EMPTY.
Re: Detect an used function -
Mean - 05.05.2011
Use GivePlayerMoneyEx naow:
pawn Код:
stock GivePlayerMoneyEx( playerid, money )
{
GivePlayerMoney( playerid, money );
print( "GivePlayerMoneyEx used. " );
return true;
}
usage:
pawn Код:
CMD:money( playerid, params[ ] )
{
GivePlayerMoneyEx( playerid, 500 );
return 1;
}
RCON print:
Код:
GivePlayerMoneyEx used.
Re: Detect an used function -
Biesmen - 05.05.2011
Oh, I didn't know the ALS Hooking would do the same for functions. Thank you very much.