Edit default samp function
#1

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

Quote:
Originally Posted by Y_Less
View Post
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
Reply
#3

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

Hook it.
Reply
#5

Oh god I don't even know what is pragma used for. So what do you mean by "new compiler"
Reply
#6

Quote:
Originally Posted by TokicMajstor
View Post
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.
Reply
#7

Here you are:

Code:
stock _SetPlayerHealth(playerid, health)
{
	Your code here
}
#define SetPlayerHealth(%0,%1) _SetPlayerHealth(%0, %1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)