Help with speedometer
#1

Hi, i am about to make a simple speedometer, but the problem is that it show's correctly just for the first player (id:0) who connect's first, while another player's(id:1) speedometer is freezed and didn't show any speed. I use a simple timer every 200ms:
pawn Код:
public Speed()
{
    foreach (Player, i)
    {
        new
        vehicleid = GetPlayerVehicleID(i);
        if(GetVehicleModel(GetPlayerVehicleID(i))==510||GetVehicleModel(GetPlayerVehicleID(i))==509||GetVehicleModel(GetPlayerVehicleID(i))==481) return 1;
        if((IsPlayerConnected(i))&&(IsPlayerInAnyVehicle(i)))
        {
            new speed[MAX_PLAYERS][18],fuel[14],Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;

            GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
            final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*200.0; // 250.666667 = kmph  
            final_speed_int = floatround(final_speed,floatround_round);

            format(fuel[i],sizeof(fuel),"Fuel: %i l", VehicleFuel[vehicleid]);
            format(speed[i],sizeof(speed),"Speed: %d km/h", final_speed_int);


            TextDrawSetString(textdraws[Textdraw0][i],speed[i]);
            TextDrawSetString(textdraws[Textdraw2][i],fuel[i]);
            return 1;
        }
        else
        {
                TextDrawSetString(textdraws[Textdraw0][i],"");
                TextDrawSetString(textdraws[Textdraw2][i],"");
        }
    }
    return 1;
}
Anyone who see the problem?
Reply


Messages In This Thread
Help with speedometer - by ajwar - 10.04.2011, 08:31
Re: Help with speedometer - by sansko - 10.04.2011, 08:37
Re: Help with speedometer - by ajwar - 10.04.2011, 10:13
Re: Help with speedometer - by LiamM - 10.04.2011, 12:06
Re: Help with speedometer - by ajwar - 10.04.2011, 12:45

Forum Jump:


Users browsing this thread: 1 Guest(s)