Detect if player moved.
#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


Messages In This Thread
Detect if player moved. - by ZamaXor - 01.11.2010, 14:29
Re: Detect if player moved. - by CJ101 - 01.11.2010, 14:36
Re: Detect if player moved. - by ZamaXor - 01.11.2010, 14:39
Re: Detect if player moved. - by Zimon95 - 01.11.2010, 15:34
Re: Detect if player moved. - by Bessensap - 01.11.2010, 15:44

Forum Jump:


Users browsing this thread: 1 Guest(s)