SpeedoMeter Simple Bug!
#1

Hello everyone

pawn Код:
forward UpdateSpeed();
public UpdateSpeed()
{
    new Float:vh;
    new S_string[256];
    new Float:Sp_x, Float:Sp_y, Float:Sp_z;
    new Float:kmh_speed, kmh_speed_int;
    new bool:HasSpeedo[MAX_PLAYERS];
   
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    new vehicleid; vehicleid = GetPlayerVehicleID(i);
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && Dash[i] == 1) //Dash = enable/disable Speedometer
        {
            if(HasSpeedo[i])
            {
                GetVehicleHealth(vehicleid, vh);
                GetVehicleVelocity(vehicleid,Sp_x,Sp_y,Sp_z);
                kmh_speed = floatsqroot(((Sp_x*Sp_x)+(Sp_y*Sp_y))+(Sp_z*Sp_z))*136.666667;
                kmh_speed_int = floatround(kmh_speed,floatround_round);
            format(S_string,256,"~g~Vehicle : ~w~%s ~n~ ~b~KM/H : ~w~%d ~n~~r~Vehicle Health:~w~ %.2f",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],kmh_speed_int,vh);
                TextDrawHideForPlayer(i, Speedo[i]);
                TextDrawSetString(Speedo[i], S_string);
                TextDrawShowForPlayer(i, Speedo[i]);
            }
            else
            {
                GetVehicleHealth(vehicleid, vh);
                GetVehicleVelocity(vehicleid,Sp_x,Sp_y,Sp_z);
                kmh_speed = floatsqroot(((Sp_x*Sp_x)+(Sp_y*Sp_y))+(Sp_z*Sp_z))*136.666667;
                kmh_speed_int = floatround(kmh_speed,floatround_round);
                format(S_string,256,"~g~Vehicle : ~w~%s ~n~ ~b~KM/H : ~w~%d ~n~~r~Vehicle Health:~w~ %.2f",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],kmh_speed_int,vh);
                Speedo[i] = TextDrawCreate(320.00, 370.00, S_string);
                TextDrawSetOutline(Speedo[i], 1);
                TextDrawFont(Speedo[i], 1);
                TextDrawSetProportional(Speedo[i], 2);
                TextDrawAlignment(Speedo[i], 2);
                TextDrawSetShadow(Speedo[i],1);
                TextDrawShowForPlayer(i, Speedo[i]);
                HasSpeedo[i] = true;
            }
        }
    }
}
and a Timer OnGameModeInit for UpdateSpeed
BUT: when I take a car the speedometer show but when the timer will SetString it creat another TextDraw on the Old
and there is many TextDraws
HOW can I do for it show one TextDraw and it SetString without another one
AND if I exit car TextDraw will hidden !

Sorry for my bad English
I hope I'll find someone to solve it
Thanks as begin =)
Reply


Messages In This Thread
SpeedoMeter Simple Bug! - by Yaszine - 08.02.2011, 23:17
Re: SpeedoMeter Simple Bug! - by -Rebel Son- - 09.02.2011, 00:45
Re : SpeedoMeter Simple Bug! - by Yaszine - 09.02.2011, 09:28
Re : SpeedoMeter Simple Bug! - by Yaszine - 09.02.2011, 14:08
Re : SpeedoMeter Simple Bug! - by Yaszine - 10.02.2011, 20:25
Re: SpeedoMeter Simple Bug! - by -Rebel Son- - 10.02.2011, 20:41
Re : SpeedoMeter Simple Bug! - by Yaszine - 11.02.2011, 19:59
Re: SpeedoMeter Simple Bug! - by Baboon - 11.02.2011, 20:20
Re : SpeedoMeter Simple Bug! - by Yaszine - 11.02.2011, 22:24
Re : SpeedoMeter Simple Bug! - by Yaszine - 11.02.2011, 22:34

Forum Jump:


Users browsing this thread: 1 Guest(s)