Edit default samp 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: Edit default samp function (
/showthread.php?tid=664944)
Edit default samp function -
TokicMajstor - 16.03.2019
Basically I want to add something to function SetPlayerHealth, so how can I edit it. Like if I want to automatically set the armour and health with that function,
but I don't want to make another function like SetPlayerHealthEx
Re: Edit default samp function -
TokicMajstor - 16.03.2019
Quote:
Originally Posted by Y_Less
Why not? That's exactly what new functions are for - combining repeated bits of code. If you start editing the original functions you:
a) Make it harder to update.
b) Become incompatible with all includes and other code.
c) Prevent others from working with you on the script because they no longer know what standard functions do.
They are called "standard" functions for a reason.
|
Thank you for pointing that out
Re: Edit default samp function -
TokicMajstor - 16.03.2019
But if I make new function for setting health, how can I always remind myself to not use SetPlayerHealth. Can I somehow get warning in compiler when using it?
Re: Edit default samp function -
TheToretto - 17.03.2019
Hook it.
Re: Edit default samp function -
TokicMajstor - 17.03.2019
Oh god I don't even know what is pragma used for. So what do you mean by "new compiler"
Re: Edit default samp function -
FinStar - 17.03.2019
Quote:
Originally Posted by TokicMajstor
Oh god I don't even know what is pragma used for. So what do you mean by "new compiler"
|
lol, u don't know the basics of pawn, but u want to create something in Pawn.
Re: Edit default samp function -
raydx - 17.03.2019
Here you are:
Code:
stock _SetPlayerHealth(playerid, health)
{
Your code here
}
#define SetPlayerHealth(%0,%1) _SetPlayerHealth(%0, %1)