CLEO Help Detect the nearest car SAMP

CLEO related

BaseBoom

Member
Joined
Oct 9, 2013
Messages
16
Reaction score
0
How to detect the nearest car around and get in


Code:
:CT
Actor.PutAt($PLAYER_ACTOR, 1@, 2@, 3@)
0860: link_actor $PLAYER_ACTOR to_interior 0
wait 500
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 5@ closest_ped_to 7@
056E:   car 5@ defined
wait 200
036A: put_actor $PLAYER_ACTOR in_car 5@
wait 500

0860: link_actor $PLAYER_ACTOR to_interior 0
Car.PutAt($PLAYER_ACTOR, 1967.55 2162.38 10.82)
jump @WaitCD

This is part of my code Unable to detect surrounding cars and unable to board Then it will game crash

This is SAMP
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
this stores nearst actor and car to the variables 5@ and ped to 7@
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 5@ closest_ped_to 7@


Next, you need to check if the stored car is valid.

if
056E: car 5@ defined
then
// there is a car
036A: put_actor $PLAYER_ACTOR in_car 5@

end
 
Top