CLEO Help [Script] Getting a car's name

CLEO related
Status
Not open for further replies.

proteh

Member
Joined
Jun 18, 2013
Messages
21
Reaction score
0
Well, I have this script.

0407: store_coords_to 3@ 4@ 5@ from_car 0@ with_offset 1.5 20.0 0.0
0407: store_coords_to 6@ 7@ 8@ from_car 0@ with_offset -1.5 0.0 0.0
053E: 9@ = get_random_car_with_model -1 in_rectangle_cornerA 3@ 4@ cornerB 6@ 7@

I want to get 9@'s car name, like Admiral, Clover, etc and then store that name in a text file. How can I get the car's name?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
0AE2: 1@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 133337.0 find_next 0 pass_wrecked 1
0ADB: 0@v = car_model 1@ name
0AF5: write_string 0@v to_ini_file "cleoconfig.ini" section "SectionName"
 

proteh

Member
Joined
Jun 18, 2013
Messages
21
Reaction score
0
I have this.

if and
Player.Defined($PLAYER_CHAR)
Actor.Driving($PLAYER_ACTOR)
then
0811: 3@ = actor $PLAYER_ACTOR car_nosave
0407: store_coords_to 4@ 5@ 6@ from_car 3@ with_offset 1.5 20.0 0.0
0407: store_coords_to 7@ 8@ 9@ from_car 3@ with_offset -1.5 0.0 0.0
053E: 10@ = get_random_car_with_model -1 in_rectangle_cornerA 4@ 5@ cornerB 7@ 8@
0ADB: 11@v = car_model 10@ name
0AF5: write_string 11@v to_ini_file "cleovehiculo.ini" section "VEHICULO" key "V"
end

I crash when entering a vehicle, I suppose I have to check if 10@ is NULL? If so, how?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
First do you want to get the closest car name? I just did it for the closest car:

{$CLEO .cs}
THREAD "THREAD_BY_OPCODEXE"
0662: NOP "www.youtube.com/OpcodeXe"
0662: NOP ""


while true
wait 0
if
Player.Defined($PLAYER_CHAR)
then
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 1@ closest_ped_to 0@
if
Car.Defined(1@)
then
0ADB: 2@v = car_model 1@ name
0AF5: write_string 2@v to_ini_file "cleovehiculo.ini" section "VEHICULO" key "V"
wait 250
end
end
end
 

proteh

Member
Joined
Jun 18, 2013
Messages
21
Reaction score
0
First do you want to get the closest car name? I just did it for the closest car:

{$CLEO .cs}
THREAD "THREAD_BY_OPCODEXE"
0662: NOP "www.youtube.com/OpcodeXe"
0662: NOP ""


while true
wait 0
if
Player.Defined($PLAYER_CHAR)
then
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 1@ closest_ped_to 0@
if
Car.Defined(1@)
then
0ADB: 2@v = car_model 1@ name
0AF5: write_string 2@v to_ini_file "cleovehiculo.ini" section "VEHICULO" key "V"
wait 250
end
end
end

I want to get the name of the car in front of me, I have this:

[...]
if and
Player.Defined($PLAYER_CHAR)
Actor.Driving($PLAYER_ACTOR)
then
0811: 3@ = actor $PLAYER_ACTOR car // Vehiculo actual...
0407: store_coords_to 4@ 5@ 6@ from_car 3@ with_offset 1.5 20.0 0.0
0407: store_coords_to 7@ 8@ 9@ from_car 3@ with_offset -1.5 0.0 0.0
053E: 10@ = get_random_car_with_model -1 in_rectangle_cornerA 4@ 5@ cornerB 7@ 8@
if
056E: car 10@ defined
then
0441: 12@ = car 10@ model
0ADB: 11@v = car_model 12@ name
0ADE: 11@v = text_by_GXT_entry 11@v
0AF5: write_string 11@v to_ini_file "cleovehiculo.ini" section "VEHICULO" key "V"
end
end
[...]

I tested it on SAMP but it doesn't work. Maybe it only works on Single Player... but I need this to quickly say the name of the car in front of me when I'm in a pursuit.
 
Status
Not open for further replies.
Top