Detect if a players moved since /fix
#4

Yup, you have to use GetPlayerPos().
You can try defining the old positions as a global variable.
Code:
new Float:OldPos[3]; //under defines


CMD:fix(playerid,params[])
{
    new Float:health;
    new veh;
    GetPlayerPos(playerid, OldPos[0], OldPos[1], OldPos[2]);
    veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "You need to be in a vehicle to use this");
    else if(health > 999) return SendClientMessage(playerid,red,"Your vehicles at 100%");
    SetTimer("repairtime",10000,false);
    SendClientMessage(playerid,green,"Help will arrive in 10 seconds. Please wait.");
    return 1;
}
Then create a timer that checks if OldPos[0], OldPos[1] and OldPos[2] are equal to the players current positon. (Which you get with GetPlayerPos()
Reply


Messages In This Thread
Detect if a players moved since /fix - by DobbysGamertag - 20.04.2013, 01:00
Re: Detect if a players moved since /fix - by BigGroter - 20.04.2013, 01:05
Re: Detect if a players moved since /fix - by DobbysGamertag - 20.04.2013, 01:17
Re: Detect if a players moved since /fix - by BigGroter - 20.04.2013, 01:23

Forum Jump:


Users browsing this thread: 3 Guest(s)