Detect if player moved.
#1

I need something like when someonce type /joinstant it will say him "Please don't move and wait 10 seconds." If player move in this 10 seconds it will say him "You moved and failed to join the stunt area."So it must teleport the player after 10 sec if he not moved to sunt zone.
Reply
#2

Just freeze the player for ten seconds.
Reply
#3

i don't want to freeze the player. i just want what i asked for. so if you can help reply if you can't, don't!
Reply
#4

You can check if the player position is the same every X seconds using a timer and function GetPlayerPos.
Reply
#5

put this from when u dont want him to move:
pawn Код:
new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
   
    SetPVarFloat(playerid,"posx",x);
    SetPVarFloat(playerid,"posy",y);
    SetPVarFloat(playerid,"posz",z);
      PlayerCanMove[playerid] = false;
in onplayerupdate:
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(!PlayerCanMove[playerid])
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
                SetTimerEx("PlayerCanMove",10000,false,"i",playerid);
        if(GetPVarFloat(playerid,"posx") != x && GetPVarFloat(playerid,"posx") != y && GetPVarFloat(playerid,"posz") != z)
        {
            SetPlayerPos(playerid,your_x_here,your_y_here,your_z_here);
            SendClientMessage(playerid,YOUR_COLOR,"Failed to enter stuntzone, you moved!");
        }
    else
    {
        SetPlayerPos(playerid,stuntparkcoords);
        SendClientMessage(playerid,YOUR_COLOR,"Welcome to the stuntzone.");
    }
}
global new:
pawn Код:
new bool:PlayerCanMove[MAX_PLAYERS];
Anywhere:
pawn Код:
forward PlayerCanMove(playerid);
public PlayerCanMove(playerid)
{
    PlayerCanMove[playerid] = true;
}

not tested
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)