Weird speedometer behaviour after some time the server is on
#1

I've got a problem with my speedometer wich i cant seem to be abled to resolve. it happens after a long time the server is on.

Vid: https://www.youtube.com/watch?v=rZTW75WDQng

Code of speedometer:
pawn Код:
public speedometer(playerid)
{
    TextDrawShowForPlayer(playerid, Status[playerid]);
    TextDrawShowForPlayer(playerid, Speedometer[playerid]);
    TextDrawShowForPlayer(playerid, Fuel[playerid]);
    TextDrawShowForPlayer(playerid, Model[playerid]);
    new string3[50], modelid = GetVehicleModel(GetPlayerVehicleID(playerid));
    if( modelid <= 611 && modelid >= 400 )
    {
        format(string3, sizeof(string3), "~y~%s", VehicleNames2[modelid-400]);
    }
    TextDrawSetString(Model[playerid], string3);
    new vehicleid = GetPlayerVehicleID(playerid), Float:CarHealth;
    GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]);
    s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*158.179;
    s2[playerid] = floatround(s1[playerid], floatround_round);
    APlayerData[playerid][PlayerSpeed] = s2[playerid];
    format(s3[playerid], 128, "~w~Speed: %i KPH", s2[playerid]);
    TextDrawSetString(Speedometer[playerid], s3[playerid]);
    if((s2[playerid] > 10) && (AVehicleData[vehicleid][FuelData] > 0))
        AVehicleData[vehicleid][FuelData] = AVehicleData[vehicleid][FuelData] - 1;
    new FuelStatus[128], string[50], CStatus[50], string2[50];

    if ((AVehicleData[vehicleid][FuelData] > 0) && (AVehicleData[vehicleid][FuelData] < 50000))
        format(FuelStatus, 128, "~w~%s%s", "I", "...................");

    if ((AVehicleData[vehicleid][FuelData] > 50000) && (AVehicleData[vehicleid][FuelData] < 100000))
        format(FuelStatus, 128, "~w~%s~w~%s", "II", "..................");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 1)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 1.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "III", ".................");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 1.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 2)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIII", "................");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 2)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 2.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIII", "...............");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 2.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 3)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIII", "..............");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 3)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 3.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIII", ".............");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 3.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 4)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIII", "............");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 4)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 4.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIII", "...........");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 4.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIII", "..........");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 5.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIII", ".........");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 5.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 6)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIIII", "........");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 6)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 6.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIIIII", ".......");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 6.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 7)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIIIIII", "......");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 7)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 7.5)))
        format(FuelStatus, 128, "~w~%s%s", "IIIIIIIIIIIIIII", ".....");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 7.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 8)))
        format(FuelStatus, 128, "~w~%s%s", "IIIIIIIIIIIIIIII", "....");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 8)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 8.5)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIIIIIIIII", "...");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 8.5)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 9)))
        format(FuelStatus, 128, "~w~%s~w~%s", "IIIIIIIIIIIIIIIIII", "..");

    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 9)) && (AVehicleData[vehicleid][FuelData] < ((MaxFuel / 10) * 9.5)))
        format(FuelStatus, 128, "~w~%s%s", "IIIIIIIIIIIIIIIIIII", ".");
       
    if ((AVehicleData[vehicleid][FuelData] >= ((MaxFuel / 10) * 9.5)) && (AVehicleData[vehicleid][FuelData] <= MaxFuel))
        format(FuelStatus, 128, "~g~%s", "IIIIIIIIIIIIIIIIIIII");
    if (AVehicleData[vehicleid][FuelData] == 0)
    {
        format(FuelStatus, 20, "~r~%s", "EMPTY");
        new Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, Lights, Alarm, Doors, Bonnet, Boot, Objective);
    }
    format(string, 50, "~w~Fuel: %s", FuelStatus);
    TextDrawSetString(Fuel[playerid], string);
    GetVehicleHealth(GetPlayerVehicleID(playerid), CarHealth);
    if(CarHealth >= 1000)
        format(CStatus, 50, "Perfect");
    if((CarHealth > 600) && (CarHealth < 1000))
        format(CStatus, 50, "Good");
    if((CarHealth > 300) && (CarHealth < 600))
        format(CStatus, 50, "Poor");
    if(CarHealth < 300)
    {
        format(CStatus, 50, "~r~Wrecked");
        SetVehicleHealth(GetPlayerVehicleID(playerid), 250);
        new Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, Lights, Alarm, Doors, Bonnet, Boot, Objective);
        APlayerData[playerid][EngineStarted] = 0;
        APlayerData[playerid][gEngine] = 0;
    }

    format(string2, 50, "~w~State: %s", CStatus);
    TextDrawSetString(Status[playerid], string2);
    TextDrawShowForPlayer(playerid, SpeedBox[playerid]);
    return 1;
}
Does anyone know the problem? :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)