Detect a position.
#1

Hello!

I want to know how to detect if we are beside the vehicle fuel cap for refueling.

Thank you .
Reply
#2

You'd have to do it for each vehicle as the fuel caps are of course not in the same place (some are left of the vehicle, some are right, some don't even exist on a given vehicle, some are higher, some are lower), and you'd have to make some calculations too for each of the vehicle (get the vehicle pos and then add to/remove from the coordinates to find where the fuel cap exactly is). After that you'd have to check if the player is near the fuel cap on a very small radius (I'd recommend 2, but you can do your bits and bobs to make it more accurate, again, this can vary (but very small) for each vehicle) with IsPlayerInRangeOfPoint. So in context it's completely possible but just requires a lot of work, a lot.

A quick way out of this would just to check if the player is near the vehicle, you would just use GetVehiclePos and then GetPlayerDistanceFromPoint or IsPlayerInRangeOfPoint (I'd use this instead of GPDFP) to determine this.
Reply
#3

UP, please.
Reply
#4

UP, please.
Reply
#5

Try this ? : https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)