#4

There is actually nothing wrong with that, the thing thats not working properly is that if I stealfuel for the first time it's all working fine and then the second time it's getting messed up.
Here is it tho.
pawn Код:
stock GetDistanceToCar(playerid, veh, Float: posX = 0.0, Float: posY = 0.0, Float: posZ = 0.0) {

    new
        Float: Floats[2][3];

    if(posX == 0.0 && posY == 0.0 && posZ == 0.0) {
        if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, Floats[0][0], Floats[0][1], Floats[0][2]);
        else GetVehiclePos(GetPlayerVehicleID(playerid), Floats[0][0], Floats[0][1], Floats[0][2]);
    }
    else {
        Floats[0][0] = posX;
        Floats[0][1] = posY;
        Floats[0][2] = posZ;
    }
    GetVehiclePos(veh, Floats[1][0], Floats[1][1], Floats[1][2]);
    return floatround(floatsqroot((Floats[1][0] - Floats[0][0]) * (Floats[1][0] - Floats[0][0]) + (Floats[1][1] - Floats[0][1]) * (Floats[1][1] - Floats[0][1]) + (Floats[1][2] - Floats[0][2]) * (Floats[1][2] - Floats[0][2])));
}

stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID) {

    new
        Float: Distance,
        target = -1,
        Float: vPos[3];

    if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
    else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);

    for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400) {
        if(v != exception && (target < 0 || Distance > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]))) {
            target = v;
            Distance = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]);
        }
    }
    return target;
}
Reply


Messages In This Thread
Fuel - by RALL0 - 13.07.2013, 21:36
Re: Fuel - by RALL0 - 13.07.2013, 23:26
AW: Fuel - by Macronix - 13.07.2013, 23:30
Re: Fuel - by RALL0 - 13.07.2013, 23:34
AW: Fuel - by Macronix - 13.07.2013, 23:49
Re: Fuel - by RALL0 - 13.07.2013, 23:51
AW: Fuel - by Macronix - 14.07.2013, 00:07
Re: Fuel - by RALL0 - 14.07.2013, 00:12
AW: Fuel - by Macronix - 14.07.2013, 00:20
Re: Fuel - by RALL0 - 14.07.2013, 00:24

Forum Jump:


Users browsing this thread: 1 Guest(s)