Need Small help Rep +
#1

Код:
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..
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)