Custom 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Custom Functions (
/showthread.php?tid=159427)
Custom Functions -
benyaminx - 13.07.2010
Would this work in an include for anything I might want to call on using a certain function?
Код:
stock SetPlayerHealth2 (playerid, Float:health)
{SetPlayerHealth (playerid, health);
//call a custom callback/function here
}
stock SetPlayerPos2 (playerid, Float:x, Float:y, Float:z)
{SetPlayerPos (playerid, x, y, z);
//call a custom callback/function here
}
#define SetPlayerHealth SetPlayerHealth2
#define SetPlayerPos SetPlayerPos2
Would this work, or is there a way it can done otherwise?
Re: Custom Functions -
SpiderPork - 13.07.2010
Test it...
Re: Custom Functions -
benyaminx - 13.07.2010
i cant right now, i dont have access to samp, i just had this idea suddenly and wanted to see if anyone else had done anything like it.
Re: Custom Functions -
RyDeR` - 13.07.2010
This will work:
pawn Код:
#define SetPlayerHealth SetPlayerHealth2
#define SetPlayerPos SetPlayerPos2
Yes but return them.
pawn Код:
stock SetPlayerHealth2 (playerid, Float:health)
{
return SetPlayerHealth (playerid, health); //call a custom callback/function here
}
stock SetPlayerPos2 (playerid, Float:x, Float:y, Float:z)
{
return SetPlayerPos (playerid, x, y, z); //call a custom callback/function here
}
Re: Custom Functions -
benyaminx - 13.07.2010
thankyou, i will try it out later. i thought it would be very useful for using createvehicle and foreach (adding to the itterator automatically using this)
Re: Custom Functions -
Hiddos - 13.07.2010
Or SendClientMessage. Typing that all the time is seriously eating my brain ^^