19.02.2016, 19:34
Basically, once I start driving it says I've crashed and applied the drunk anim
pawn Код:
Function:CheckSpeed(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:speed[3], vid =GetPlayerVehicleID(playerid);
GetVehicleVelocity(vid, speed[0], speed[1], speed[2]);
if(speed[0] < -0.4 || speed[0] > 0.4 || speed[1] < -0.4 || speed[1] > 0.4)
{
Crashing[playerid] = SetTimerEx("Crash", 100, 1, "i", playerid);
}
}
return 1;
}
Function:Crash(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new
Float:speed_float,
speed_int,
Float:speed[3],
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(playerid, speed[0], speed[1], speed[2]);
if(speed[0] > -0.1 && speed[0] < 0.1 && speed[1] > -0.1 && speed[1] < 0.1)
{
SetPlayerDrunkLevel(playerid, 50000);
}
//speed_float = floatsqroot(((speed[0]*speed[0])+(speed[1]*speed[1]))+(speed[2]*speed[2]))*95.0;
//speed_int = floatround(speed_float, floatround_round);
}
return 1;
}