CLEO Help detect nearest vehicle.

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,716
Solutions
1
Reaction score
111
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@

036A: put_actor $PLAYER_ACTOR in_car 0@

someone already made this CLEO so I wouldn't see any point in creating it.
 

jasonbigcock03

Active member
Joined
Jul 8, 2017
Messages
37
Reaction score
0
Zin said:
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@

036A: put_actor $PLAYER_ACTOR in_car 0@

someone already made this CLEO so I wouldn't see any point in creating it.

Code:
{$CLEO .cs}

////////////MAIN//////////
0000:NOP
thread "main"
0B43: samp register_client_command "troll" to_label @teleport

:blank
wait 0
jump @blank

WHILE TRUE
:teleport
wait 0
IF
Not Actor.Driving($PLAYER_ACTOR)
THEN
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)
wait 100                                                    
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@
jf @teleport
wait 100
072A: put_actor $PLAYER_ACTOR into_car 0@ driverseat
wait 100
goto @setfire
0B43: samp cmd_ret
END

:setfire
wait 0
IF
Actor.Driving($PLAYER_ACTOR)
THEN
5@ = Actor.CurrentCar($PLAYER_ACTOR)
jf @setfire
wait 100
0224: set_car 6@ health_to 200
wait 100
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at 7@ 8@ 9@
END

END
bro so i made a basic cleo for detect nearest vehicle and seting health 200 but idk what did i wrong. can you look at my script and correct me. ty
 

jasonbigcock03

Active member
Joined
Jul 8, 2017
Messages
37
Reaction score
0
bladero said:
Looks like 0AB5 isnt working. In one thread supahdupahnubah said that it doesnt work in multiplayer.

so do you know any opcode for it which works in mp? also thanks for the information.
 

bladero

Active member
Joined
Jan 3, 2017
Messages
73
Reaction score
0
Well you would need to write your own function to detect nearest vehicle but what you can do is get the vehicle id by putting it into the command example: /troll 164(This is vehicle id). Or type the id of the player then get data from his vehicle and then do what you want with the car.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,716
Solutions
1
Reaction score
111
0AB5 works fine for me...


Code:
:Noname_75
wait 0 
if and
8B21: not samp is_chat_opened 
key_down 54 
else_jump @Noname_261 
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@ 
if 
056D:   actor 1@ defined 
else_jump @Noname_209 
2@ = SAMP.GetSAMPPlayerIDByActorHandle(1@)
say "/kidnap %d" 2@ 
018C: play_sound 1052 at 0.0 0.0 0.0 
print "~y~Player ~r~Kidnapped!" 1000 
wait 500 
jump @Noname_261
 

jasonbigcock03

Active member
Joined
Jul 8, 2017
Messages
37
Reaction score
0
bladero said:
Well you would need to write your own function to detect nearest vehicle but what you can do is get the vehicle id by putting it into the command example: /troll 164(This is vehicle id). Or type the id of the player then get data from his vehicle and then do what you want with the car.

i see some hacks can tp you into spesific pid's vehicle or directly into vehicle id. how can i do it then?


Zin said:
0AB5 works fine for me...


Code:
:Noname_75
wait 0 
if and
8B21: not samp is_chat_opened 
key_down 54 
else_jump @Noname_261 
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@ 
if 
056D:   actor 1@ defined 
else_jump @Noname_209 
2@ = SAMP.GetSAMPPlayerIDByActorHandle(1@)
say "/kidnap %d" 2@ 
018C: play_sound 1052 at 0.0 0.0 0.0 
print "~y~Player ~r~Kidnapped!" 1000 
wait 500 
jump @Noname_261

OkiHtfd.png
 

bladero

Active member
Joined
Jan 3, 2017
Messages
73
Reaction score
0
First you need to get parameters or what you just typed using 0B35: . Using the 0AD4: you can scan string and look for information in typed command /troll 164<<--- talking about this number here.

Code:
0B35: samp 0@ = get_last_command_params
IF
0AD4: 4@ = scan_string 0@ format "%d + %d = %d" 5@ 6@ 7@ //change this how you want
THEN
//something
ELSE
//type message in chat or something how the command should be used
END
I seen that you were using c# and c++ so you know what data types are %s is string &d is integer and %f is float.
 

jasonbigcock03

Active member
Joined
Jul 8, 2017
Messages
37
Reaction score
0
bladero said:
First you need to get parameters or what you just typed using 0B35: . Using the 0AD4: you can scan string and look for information in typed command /troll 164<<--- talking about this number here.

Code:
0B35: samp 0@ = get_last_command_params
IF
0AD4: 4@ = scan_string 0@ format "%d + %d = %d" 5@ 6@ 7@ //change this how you want
THEN
//something
ELSE
//type message in chat or something how the command should be used
END
I seen that you were using c# and c++ so you know what data types are %s is string &d is integer and %f is float.
i love this basic and clear tuts. ty bro.
 

Ninja FTW

Active member
Joined
Aug 11, 2017
Messages
61
Reaction score
0
Location
Saturn
Use simple!

PHP:
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@ // This will store the XYZ Position in Variable 1@ 2@ 3@ (X = 1@, Y = 2@, Z = 3@)
if
  0AE2: 4@ = random_vehicle_near_point 1@ 2@ 3@ in_radius 10.0 find_next 0 pass_wrecked 0 // random car in near point and nearest car in particular radius
jf @CAR
036A: put_actor $PLAYER_ACTOR in_car 4@ // put actor in car
 

Ninja FTW

Active member
Joined
Aug 11, 2017
Messages
61
Reaction score
0
Location
Saturn
Working one!

PHP:
{$CLEO .cs}
0000: NOP // Add "0000: NOP" or "thread "" ". Choose only one

0B43: samp register_client_command ".tr" to_label @teleport

:blank
wait 0
jump @blank

:teleport // In "0b43" you need to jump on @teleport label so, make it in label
wait 0
IF
80DF: not  actor $PLAYER_ACTOR driving    // always add opcodes and yeah! for adding 'not' statement in a opcode.. you have to change the first number of opcode to '8' like:  from 00DA: to 80DA:
THEN
Actor.StorePos($PLAYER_ACTOR, 7@, 8@, 9@)
IF                                                    
0AE2: 4@ = random_vehicle_near_point 7@ 8@ 9@ in_radius 10.0 find_next 0 pass_wrecked 0 // this opcode always comes in condition like after from 'if' statement
// You store the player current position in 7@, 8@, 9@ variables. So, near point will also be in 7@, 8@, 9@ not 1@, 2@, 3@ because it'll crash
THEN // do not ever mix high-level in low-level and low-level in high-level
wait 100
036A: put_actor $PLAYER_ACTOR in_car 4@
wait 100
IF or 
00DB:   actor $PLAYER_ACTOR in_car 4@ 
00DF:   actor $PLAYER_ACTOR driving
THEN
0224: set_car 4@ health_to 200
wait 100
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at 7@ 8@ 9@
END
0B43: samp cmd_ret

And i suggest you to read this: http://ugbase.eu/Thread-Sanny-Builder-Syntax?highlight=SYNTAX
 
Status
Not open for further replies.
Top