SA-MP Forums Archive
Need Small help Rep + - 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: Need Small help Rep + (/showthread.php?tid=560674)



Need Small help Rep + - MBilal - 29.01.2015

Код:
stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z)
{
    pInfo[playerid][pOldPos][0] = x;
   	pInfo[playerid][pOldPos][1] = y;
    pInfo[playerid][pOldPos][2] = z;
    SetPlayerPos(playerid, x, y, z);
}

I'm using a Timer to check new postion of Player
GetPlayerPos(playerid, pInfo[playerid][pnewPos][0],pInfo[playerid][pnewPos][1],pInfo[playerid][pnewPos][2]);

what should i do now ?
trying to make Anti Teleport..


Re: Need Small help Rep + - Schneider - 29.01.2015

You could use SetTimerEx, you'll only need to adjust the interval of the timer and the range to your own liking.

pawn Код:
stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z)
{
    pInfo[playerid][pOldPos][0] = x;
    pInfo[playerid][pOldPos][1] = y;
    pInfo[playerid][pOldPos][2] = z;
    SetPlayerPos(playerid, x, y, z);
    SetTimerEx("CheckNewPosition", 1000, 0, "u", playerid);
}

forward CheckNewPosition(playerid);
public CheckNewPosition(playerid)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, pInfo[playerid][pOldPos][0], pInfo[playerid][pOldPos][1], pInfo[playerid][pOldPos][2]))
    {
       //Player is more than 7 units away within 1 second after teleporting.
    }
    return 1;
}