Speedo problem with timer
#1

Hello guys, i have a problem with my speedo meter.
Im using ONE timer with a loop to update everyone's textdraw. But this only works for playerid 0 !

pawn Код:
forward update();
public update()
{
    for(new i =0;i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInAnyVehicle(i) != 1) return 1;
        new veh = GetPlayerVehicleID(i);
   
        //updating speed
        new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,string[128];
        GetVehicleVelocity(veh,speed_x,speed_y,speed_z);
        final_speed = floatsqroot(speed_x*speed_x + speed_y*speed_y + speed_z*speed_z)*85.4166672; // 136.666667 = kmph  // 85.4166672= mph
        final_speed = floatround(final_speed,floatround_round);
        if(floatround(final_speed,floatround_round) > 100)
        {
            format(string,sizeof string,"%iMph",floatround(final_speed,floatround_round));
        } else {
            format(string,sizeof string,"%i Mph",floatround(final_speed,floatround_round));
        }
        TextDrawSetString(speedo[i][speedo_speed],string);
       
       
        //update health
        new Float:health;
        GetVehicleHealth(veh,health);
        if(floatround(health,floatround_round) > 999)
        {
            format(string,sizeof string,"%i%",floatround(health /10,floatround_round));
        } else {
            format(string,sizeof string,"%i %",floatround(health /10,floatround_round));
        }      
        TextDrawSetString(speedo[i][speedo_health],string);
       
    }
    return 1;
}
Also other players will get the textdraw of playerid 0. Did i made any mistake here ?

Please help
Reply
#2

A BIG Mistake! Posting!
Reply
#3

pawn Код:
if(IsPlayerInAnyVehicle(i) != 1) return 1;
to
pawn Код:
if(!IsPlayerInAnyVehicle(i)) continue;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)