Good way to get this to stop tracking miles
#1

Ok i have a script that tracks how many miles you drove but i've got issue it also detects the miles when you teleport, so basically what i wanna do is when you teleport it dosen't add to the miles

1 of my teleport commands
pawn Код:
YCMD:gotols(playerid, params[], help)
{
    #pragma unused params
    if(PlayerInfo[playerid][pAdmin] < 10 && !IsPlayerAdmin(playerid)) return
        SendClientMessage(playerid, COLOR_GREY, ADMIN_CMD_ERROR);
    if (help) return
        SendClientMessage(playerid, COMMAND_HELP_COLOR, "Goto Los Santos.");
    if (GetPlayerState(playerid) == 2)
    {
        new tmpcar = GetPlayerVehicleID(playerid);
        SetVehiclePos(tmpcar, 1529.6,-1691.2,13.3);
        SetPlayerInterior(playerid,0);
        SendClientMessage(playerid,TELEPORT_COLOR, "You have been teleported to Los Santos");
    }
    else
    {
        SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
        SetPlayerInterior(playerid,0);
        SendClientMessage(playerid,TELEPORT_COLOR, "You have been teleported to Los Santos");
    }
    return 1;
}
The function starts tracking miles when they are the driver of a car

Iv'e tried many diffrent ways but none of them seem to be working. Any one have any idea to stop it from detecting miles on teleport.

I've tried stopping the timer that tracks the miles, it works but then you have to enter and exit the car to start tracking the miles again. I've tried also using variables.

This is how it tracks the miles

pawn Код:
GetPlayerPos(playerid,x2[playerid],y2[playerid],z2[playerid]);
    temp[playerid] = floatsqroot(floatpower(floatabs(floatsub(x1[playerid],x2[playerid])),2)+floatpower(floatabs(floatsub(y1[playerid],y2[playerid])),2)+floatpower(floatabs(floatsub(z1[playerid],z2[playerid])),2));
Yes i should use getvehiclepos but that still won't fix my issue since the command teleports you and the vehicle if you're in a vehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)