Define 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: Define function (
/showthread.php?tid=609066)
Define function -
ScIrUsna - 08.06.2016
Hi,
I'am making anti cheat and i don't know how to define function and i can directly call to function because now i do
stock GivePlayerMoneyZ( playerid, ammount )
{
GivePlayerMoney( playerid, ammount );
MONEY[ playerid ] +=ammount;
}
And i need in every place replace GivePlayerMoney to GivePlayerMoneyZ, how to make that i could left GivePlayerMoney but this stock get called when i call this function
Re: Define function -
Sjn - 08.06.2016
You don't really need to do that, you can just replace them all at once by pressing ctrl + H.
But anyway;
PHP код:
#if defined _ALS_GivePlayerMoney
#undef GivePlayerMoney
#else
#define _ALS_GivePlayerMoney
#endif
#define GivePlayerMoney GivePlayerMoneyZ
// stock isn't needed for this
GivePlayerMoneyZ( playerid, ammount )
{
GivePlayerMoney( playerid, ammount );
MONEY[ playerid ] +=ammount;
}
Re: Define function -
ScIrUsna - 09.06.2016
This no working because GivePlayerMoney in function giveplayermoneyz call as giveplayermoneyz and this can crash server