Detecting the vehicle
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
GetPlayerCameraTargetVehicle will return the vehicle the player is looking at (but always returns the closest even if it's at the side). About the distance thing I'm not so sure, depending on what you want to do. Getting the distance between vehicle and player and if it is not somewhat equal to that specified amount, return that there's no vehicle or detect it with other way (looping and such is not very efficient unless you have an custom iterator with all the streamed vehicles for each player).
There are a bunch tricks to getting closest vehicle, a couple mentioned here, but I'll add this to what he said: there is a IsVehicleStreamedIn(vehicleid, forplayerid) which can be combined with a foreach loop if all the other ways fails (checkin if player is in a vehicle or the first function.) but custom iterators would bypass calling this native which would make it very fast.
Reply


Messages In This Thread
Detecting the vehicle - by cdoubleoper - 28.05.2016, 18:53
Re: Detecting the vehicle - by Darkwood17 - 28.05.2016, 19:22
Re: Detecting the vehicle - by Konstantinos - 28.05.2016, 19:25
Re: Detecting the vehicle - by PrO.GameR - 28.05.2016, 20:12
Re: Detecting the vehicle - by cdoubleoper - 28.05.2016, 21:17

Forum Jump:


Users browsing this thread: 2 Guest(s)