Detect an used function
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

Oh, I didn't know the ALS Hooking would do the same for functions. Thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)