Which CMD to use to freeze a car?
#1

How can i freeze a car when it enters a CP?
Reply
#2

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
Reply
#3

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)
Reply
#4

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);
Reply
#5

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

thanks @BornHuman,i solved it
Reply
#6

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)