SA-MP Forums Archive
Which CMD to use to freeze a car? - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Which CMD to use to freeze a car? (/showthread.php?tid=649593)



Which CMD to use to freeze a car? - PepsiCola23 - 11.02.2018

How can i freeze a car when it enters a CP?


Re: Which CMD to use to freeze a car? - BornHuman - 11.02.2018

https://sampwiki.blast.hk/wiki/TogglePlayerControllable will allow a player to be frozen and restrict movement even in vehicles and https://sampwiki.blast.hk/wiki/SetVehicleVelocity can edit the speed of a vehicle. Using them both together could be an easy way to do this


Re: Which CMD to use to freeze a car? - Mugala - 11.02.2018

you have to set vehicle's velocity to 0 0 0, with SetVehicleVelocity(vehicleid, 0, 0, 0) and u can also freeze a player with TogglePlayerControllable(playerid, 0) (if u want)

EDIT: BornHuman was faster, typed in same time lol (04:56)


Re: Which CMD to use to freeze a car? - Stev - 11.02.2018

How about turning the engine off.

Код:
new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;

GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);



Re: Which CMD to use to freeze a car? - PepsiCola23 - 11.02.2018

if you turn the engine of it still goes if you had speed before.

thanks @BornHuman,i solved it


Re: Which CMD to use to freeze a car? - Mugala - 11.02.2018

Quote:
Originally Posted by Stev
Посмотреть сообщение
How about turning the engine off.

Код:
new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;

GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
only turning the engine off doesn't changes the current velocity of vehicle m8.


Re: Which CMD to use to freeze a car? - Stev - 11.02.2018

Good point. My brain isn't active at this time. I'll keep quiet until my brain is awake.