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
#2

you must define the playerid in "public speed()" and "forward Speed();" and in the called function
Reply
#3

Still not working, it's shows just for the first connected player.
Reply
#4

Quote:
Originally Posted by ajwar
Посмотреть сообщение
Still not working, it's shows just for the first connected player.
I am having problems with the /engine command for my script too, it only works for the first connected player
Reply
#5

Anyone who can help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)