IF get vehicle speed?
#4

Your code will NEVER work because you're not calling ANYWHERE the VehicleSpeed function. It's just static, yes you added a message, yes you added the km/h check, but when and how VehicleSpeed gets called?

You have to call it somewhere to be sure the player will get the message. Place it in a timer maybe? (By checking if the player is in the vehicle and in the driver seat obv). Otherwise yours is just a "static" function, stays there just to increase lines in your code, nothing more.

And i suggest you to use this:

pawn Code:
GetVehicleSpeed(vehicleid, type)
{
    //Type 1: MPH - Any other type: KM/H
    //GetVehicleSpeed(GetPlayerVehicleID(playerid), 1);
   
    new s;
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);
    switch(type)
    {
        case 1: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*112.1577, floatround_round);
        default: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*180.5000, floatround_round);
    }
    return s;
}
Reply


Messages In This Thread
IF get vehicle speed? - by Lixyde - 25.03.2019, 19:13
Re: IF get vehicle speed? - by Heress - 25.03.2019, 19:20
Re: IF get vehicle speed? - by 4D1L - 25.03.2019, 19:27
Re: IF get vehicle speed? - by SymonClash - 25.03.2019, 20:03
Re: IF get vehicle speed? - by Pottus - 25.03.2019, 20:27
Re: IF get vehicle speed? - by Lixyde - 26.03.2019, 18:42
Re: IF get vehicle speed? - by raydx - 26.03.2019, 19:24
Re: IF get vehicle speed? - by zepfiz - 27.03.2019, 17:29
Re: IF get vehicle speed? - by Lokii - 27.03.2019, 19:17

Forum Jump:


Users browsing this thread: 3 Guest(s)