SA-MP Forums Archive
A question about stocks - 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: A question about stocks (/showthread.php?tid=650913)



A question about stocks - RedGun2015 - 09.03.2018

So, I read this topic https://sampforum.blast.hk/showthread.php?tid=220089 about Using Stocks or Hooks

And I really don't understand. So, instant of using

my custom function
Код:
stock GivePlayerMoneyEx(playerid, money) 
{
	PlayerMoney[playerid] += money;
	return GivePlayerMoney(playerid, money);
}
I should use this
Код:
stock My_GivePlayerMoney(playerid, money)
{
    PlayerMoney[playerid] += amount;
    return GivePlayerMoney(playerid, money);
}

#if defined _ALS_GivePlayerMoney
    #undef GivePlayerMoney
#else
    #define _ALS_GivePlayerMoney
#endif
#define GivePlayerMoney My_GivePlayerMoney
Is not the same thing?

Using GivePlayerMoney should call the stock My_GivePlayerMoney, so is like when I use GivePlayerMoneyEx for example, right?

So, what should I use? my custom function or the function like in tutorial?