SA-MP Forums Archive
[Include] SetVehicleSpeed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] SetVehicleSpeed (/showthread.php?tid=307052)



SetVehicleSpeed - AustinJ - 28.12.2011

Thought I would post this on the forums since I took the time to make it for my server. I didn't find it elsewhere.

pawn Code:
Usage: SetVehicleSpeed(vehicleid, Float:speed);
pawn Code:
stock SetVehicleSpeed(vehicleid, Float:speed)
{
    new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:a;
    GetVehicleVelocity(vehicleid, x1, y1, z1);
    GetVehiclePos(vehicleid, x2, y2, z2);
    GetVehicleZAngle(vehicleid, a); a = 360 - a;
    x1 = (floatsin(a, degrees) * (speed/100) + floatcos(a, degrees) * 0 + x2) - x2;
    y1 = (floatcos(a, degrees) * (speed/100) + floatsin(a, degrees) * 0 + y2) - y2;
    SetVehicleVelocity(vehicleid, x1, y1, z1);
}
Note: Speed is multiplied by 100 from the default velocity speeds.

+Rep would be nice for my effort.



Re: SetVehicleSpeed - Mrki_Drakula - 28.12.2011

I thing this belongs to Useful Functions thread, its pointless to put it as Include. :S
Anyway, good job.


Re: SetVehicleSpeed - System64 - 29.12.2011

You give me an idea with this function good job thanks and repped


Respuesta: SetVehicleSpeed - [Nikk] - 29.12.2011

good include man, thanks


Re: SetVehicleSpeed - KingHual - 29.12.2011

It's nice but... how is that an include? D: