SA-MP Forums Archive
How to check this - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to check this (/showthread.php?tid=249779)



How to check this - [Ha]Lommo - 20.04.2011

How to check if someone position got changed, and to get his old position and new position.
And also the name of the player who he passed.. Someone has an idea?


Re: How to check this - Sascha - 20.04.2011

pawn Код:
new timer[MAX_PLAYERS];
new Float:Pos[4];
forward MoveCheck(playerid);

public OnPlayerConnect(playerid)
{
    KillTimer(timer[playerid]);
    timer[playerid] = SetTimerEx("MoveCheck", 1000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(timer[playerid]);
    return 1;
}

public MoveCheck(playerid)
{
    new Float:x, Float:y, Float:z, Float:az, name[MAX_PLAYER_NAME], string[100];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, az);
    if(x == Pos[0] && y == Pos[1] && z == Pos[2] && az == Pos[3])
    {
        format(string, sizeof(string), "%s didn't move", name);
        print(string);
    }else{
        format(string, sizeof(string), "%s moved", name);
        print(string);
    }
    Pos[0] = x; Pos[1] = y; Pos[2] = z; Pos[3] = az;
    return 1;
}
try this as idea...
I would improve it though to make it the way you need it (if I was you)


Re: How to check this - [Ha]Lommo - 20.04.2011

I mean if he pass another car, in a race.