Get Vehicle speed.
#8

Can you explain it better and with |[PAWN]|? BEcause I really don't get a crap out of it.

This is my code for the speed:

pawn Код:
public Speedometer(playerid)
{
    new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
    vehicleid = GetPlayerVehicleID(playerid);
    new Float:vehicle_health,final_vehicle_health,health_string[256];
    if(vehicleid != 0)
    {
        GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
        final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*199.4166672; // 250.666667 = kmph  // 199,4166672= mph
        final_speed_int = floatround(final_speed,floatround_round);
        format(speed_string,256,"Speed: %i",final_speed_int);
        TextDrawSetString(SPEEDOS[playerid], speed_string);
        GetVehicleHealth(vehicleid,vehicle_health);
        final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5); //This will make the health show at 100 when the vehicle is not damaged and at 0 when it is in fire.
        format(health_string,256,"Health %i", final_vehicle_health);
        TextDrawSetString(HEALTH[playerid], health_string);
    }
    else
    {
        TextDrawSetString(SPEEDOS[playerid], " ");
        TextDrawSetString(HEALTH[playerid], " ");
    }
    return 1;
}
Now how can I make it if the car goes faster then 80 the checkpoints get 0 and also TakeLic[playerid] = 0;
??
Reply


Messages In This Thread
Get Vehicle speed. - by Mey6155 - 27.05.2014, 17:14
Re: Get Vehicle speed. - by YoungKris - 27.05.2014, 17:17
Re: Get Vehicle speed. - by Mey6155 - 27.05.2014, 17:19
Re: Get Vehicle speed. - by doreto - 27.05.2014, 17:43
Re: Get Vehicle speed. - by Mey6155 - 27.05.2014, 17:58
Re: Get Vehicle speed. - by Pottus - 27.05.2014, 18:13
Re: Get Vehicle speed. - by Lacamora - 27.05.2014, 18:23
Re: Get Vehicle speed. - by Mey6155 - 28.05.2014, 06:21
Re: Get Vehicle speed. - by Mey6155 - 28.05.2014, 13:54
Re: Get Vehicle speed. - by Pottus - 28.05.2014, 14:27

Forum Jump:


Users browsing this thread: 1 Guest(s)