Posts: 1,648
Threads: 482
Joined: Jun 2010
Alright, I'm making a trunk system, but they must be out of the vehicle to use it. But I need to check that they are in range of the vehicle.. But to do this, i'd need to store the vehicle id and get it's position, right?
How could I go about doing that?
Posts: 207
Threads: 23
Joined: May 2011
Reputation:
0
Just use GetNearestVehicleID (there is a stock somewhere, just use search), then GetVehiclePos. Then just use IsPlayerInRange. And of course you need to use variables etc.
Hope it helped.
Posts: 1,781
Threads: 13
Joined: Sep 2009
Reputation:
0
i bet he wont need a distance check looped for all vehicles. who will exit his car in angel pine, walk up to KACC fuels, and try to open the trunk 5 hours later, after walking 10 miles?
setting the last entered vehicle is the way to go with.
if the vehicleid got stored in LastVehicle[playerid], then this variable can be used with GetVehiclePos(LastVehicle[playerid],X,Y,Z), and then checked for being IsPlayerInRangeOfPoint(playerid,5,X,Y,Z). no need for any loops.