SA-MP Forums Archive
How to replace a SAMP native with another... - 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: How to replace a SAMP native with another... (/showthread.php?tid=557975)



How to replace a SAMP native with another... - Ahmad45123 - 15.01.2015

Hello all...
I have a function called SetPlayerCheckpointEx...

However, Instead of replacing all SetPlayerCheckpoint's in my code, I want to replace the SetPlayerCheckpoint function completely...

How do I do so ?

I tried these though:
pawn Код:
stock SetPlayerCheckpointEx(playerid, Float:x, Float:y, Float:z, Float:size)
{
    AdminCP[playerid][0] = x;
    AdminCP[playerid][1] = y;
    AdminCP[playerid][2] = z;
    return SetPlayerCheckpoint(playerid, x, y, z, size);
}
#if defined SetPlayerCheckpoint
    #undef SetPlayerCheckpoint
    #define SetPlayerCheckpoint SetPlayerCheckpointEx
#else
    #define SetPlayerCheckpoint SetPlayerCheckpointEx
#endif



Re: How to replace a SAMP native with another... - Ahmad45123 - 15.01.2015

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
You can find some information about function hooking in this thread: https://sampforum.blast.hk/showthread.php?tid=441293 Scroll to the end for native function hooking. You'll want to do all this right at the top of your code but after the include lines for the functions you want to hook so all future uses will use your version.
Thanks...
I just forgot the _ALS_ part