SA-MP Forums Archive
Define default 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 default function. (/showthread.php?tid=388959)



Define default function. - budelis - 31.10.2012

Hi,


I want to define default samp function to my stock, i do that:

Code:
#define SetPlayerHealth(%1,%2) SetPlayerHealthEx(%1,%2)
Am right?


Re: Define default function. - Stylock - 31.10.2012

Quote:
Originally Posted by budelis
View Post
Code:
#define SetPlayerHealth(%1,%2) SetPlayerHealthEx(%1,%2)
That works, but better would be:

pawn Code:
#if defined _ALS_SetPlayerHealth
    #undef SetPlayerHealth
#else
    #define _ALS_SetPlayerHealth
#endif
#define SetPlayerHealth Prefix_SetPlayerHealth
That way your functions won't conflict with other libraries.