How to check this
#1

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?
Reply
#2

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)
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)