SA-MP Forums Archive
Hooking a 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: Hooking a function (/showthread.php?tid=384551)



Hooking a function - BaubaS - 12.10.2012

Good day, I have a problem with hooking any samp function. Its just doesnt get called.

Code I am using:

pawn Код:
stock _ALT_SetPlayerPos(playerid, Float: fX, Float: fY, Float: fZ)
{
    printf("a");
    stopChecking[playerid] = true;
   
    acPos[playerid][0] = fX;
    acPos[playerid][1] = fY;
    acPos[playerid][2] = fZ;
   
    SetPlayerPos(playerid, fX, fY, fZ);
   
    stopChecking[playerid] = false;
    return true;
}

#if defined _ALS_SetPlayerPos
    #undef SetPlayerPos
#else
    #define _ALS_SetPlayerPos
#endif
#define SetPlayerPos _ALT_SetPlayerPos
There is no any print message when I use SetPlayerPos


Re: Hooking a function - BaubaS - 12.10.2012

Bump


Re: Hooking a function - ReVo_ - 12.10.2012

stock SetPlayerPosEx(playerid, Float: fX, Float: fY, Float: fZ)
{
printf("a");
stopChecking[playerid] = true;

acPos[playerid][0] = fX;
acPos[playerid][1] = fY;
acPos[playerid][2] = fZ;

SetPlayerPos(playerid, fX, fY, fZ);

stopChecking[playerid] = false;
return true;
}

#define SetPlayerPos SetPlayerPosEx

In top of your script ;/