ReDefining native 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: ReDefining native functions (
/showthread.php?tid=97809)
ReDefining native functions -
Calix - 16.09.2009
This seems to compile fine (haven't yet had time to test), but was wondering if this is valid to do. Basically, instead of making a whole new function, I thought, why not just redefine the current one so it is still compatible with my script. I've seen it done with callbacks, but have yet to see it done with native functions.
pawn Код:
#define IsPlayerAdmin Stock_IsPlayerAdmin
#define My_IsPlayerAdmin IsPlayerAdmin
stock My_IsPlayerAdmin(playerid) return (PlayerInfo[playerid][pAdmin] > 0 || CallLocalFunction("Stock_IsPlayerAdmin", "i", playerid));
forward Stock_IsPlayerAdmin(playerid);
This way it checks if they are an admin according to the script, or if they are logged into RCON.
Re: ReDefining native functions -
Norn - 16.09.2009
Quote:
|
Originally Posted by Calix
This seems to compile fine (haven't yet had time to test), but was wondering if this is valid to do. Basically, instead of making a whole new function, I thought, why not just redefine the current one so it is still compatible with my script. I've seen it done with callbacks, but have yet to see it done with native functions.
pawn Код:
#define IsPlayerAdmin Stock_IsPlayerAdmin #define My_IsPlayerAdmin IsPlayerAdmin stock My_IsPlayerAdmin(playerid) return (PlayerInfo[playerid][pAdmin] > 0 || CallLocalFunction("Stock_IsPlayerAdmin", "i", playerid)); forward Stock_IsPlayerAdmin(playerid);
This way it checks if they are an admin according to the script, or if they are logged into RCON.
|
You don't forward stocks and next time try it before posting, really a waste of thread space.
Re: ReDefining native functions -
Calix - 16.09.2009
Sorry. This is the scripting discussion forum, I figured it would be ok to ask a simple question. Though I'm unsure what you mean by wasting thread space, I'm sure the forum can handle a few extra topics. Thank you for responding though I guess...I've removed the forward and it still compiles fine, so I guess I'll wait till I get home so I can actually test it.