Custom Functions
#1

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

Test it...
Reply
#3

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

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
}
Reply
#5

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)
Reply
#6

Or SendClientMessage. Typing that all the time is seriously eating my brain ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)