So, how can I do that? how to detect a small area in front of a ped?
You can use
PedGetOffsetInWorldCoords function to do that.
The function has four arguments:
1. Ped (ex: gPlayer)
2. Left (> 0, greater than zero) or Right (< 0, lesser than zero)
3. Front (> 0, greater than zero) or Back (< 0, lesser than zero)
4. Up (> 0, greater than zero) or Down (< 0, lesser than zero)
It returns the desired position in coordinates (X, Y, Z).
Test the function by adding a
yellow-ground-blip in front of the player:
if IsButtonBeingPressed(3, 0) then
local FRONT_X, FRONT_Y, FRONT_Z = PedGetOffsetInWorldCoords(gPlayer, 0, 1, 0)
if BLIP then BlipRemove(BLIP) end
BLIP = BlipAddXYZ(FRONT_X, FRONT_Y, FRONT_Z, 0, 0, 7)
end