{$CLEO .cs}
0000: NOP
0B34: samp register_client_command "truck" to_label @activation
7@ = 0
0B2E: 31@ = read_samp_memory offset 0x5750 size 2 //disable spec data
0B2D: write_samp_memory offset 0x5750 value 0xC390 size 2
:First
wait 0
if
7@ == 1
jf @First
if
key_down 48 //0
then
7@ = 0
jump @First
end
0811: 0@ = actor $PLAYER_ACTOR used_car
00AA: store_car 0@ position_to 21@ 22@ 23@ //get handle of the trailer
0174: 24@ = car 0@ Z_angle //
06BE: 25@ = car 0@ y_angle //
0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 21@ 22@ 23@ Z_Angle 24@ Y_Angle 25@ Distance -9.5 Return_XYZ_To 26@ 27@ 28@ //
wait 0 //
0AE2: 1@ = random_vehicle_near_point 26@ 27@ 28@ in_radius 3.0 find_next 0 pass_wrecked 0 //
00AA: store_car 1@ position_to 15@ 16@ 17@
050A: 18@ = distance_between_XYZ 15@ 16@ 17@ and_XYZ 21@ 22@ 23@
0017: 18@ /= -1.0
gosub @checkpoint_coords
wait 0
0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 11@ 12@ 13@ Z_Angle 24@ Y_Angle 25@ Distance 18@ Return_XYZ_To 26@ 27@ 28@ // 9.47644 or -18@
wait 0
gosub @Disable_data_sent
wait 500
00AB: put_car 0@ at 11@ 12@ 13@
00AB: put_car 1@ at 26@ 27@ 28@
gosub @Enable_data_sent
wait 500
gosub @Disable_data_sent //1st place - trucker depot
0175: set_car 0@ Z_angle_to 179.856
0731: set_car 0@ y_angle_to 0.0426828
00AB: put_car 0@ at 2245.89 -2592.1 9.30011
gosub @Enable_data_sent
wait 2500
for 17@ = 0 to 999
if 0AFF: samp 1@ = car_handle_by_samp_vehicle_id 17@
then
if
0137: car 1@ model == #ARTICT3
then
0175: set_car 1@ Z_angle_to 180.044
0731: set_car 1@ y_angle_to 0.0451752
00AB: put_car 1@ at 2245.89 -2582.63 8.87267
//repeat
0AF9: samp say_msg "/truckermission"
wait 300
0AF9: samp say_msg "1"
wait 2300
{gosub @checkpoint_coords // check distance
00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@ //
wait 0 //
0509: 3@ = distance_between_XY 4@ 5@ and_XY 11@ 12@ // check distance
if
0033: 1300.0 >= 3@
then
0AF9: samp say_msg "/stopmission" //stops the mission, removes checkpoint and respawns trailer
wait 500
0175: set_car 0@ Z_angle_to 179.856 //place truck on the right position again just to be sure
0731: set_car 0@ y_angle_to 0.0426828 //
00AB: put_car 0@ at 2245.89 -2592.1 9.30011 //
wait 300
end
until 0021: 3@ > 1300.0 }
jump @First
end
end
end
print "No trailers around. Moving to 2nd place" time 1000
gosub @Disable_data_sent
wait 500 // move to 2nd place
0175: set_car 0@ Z_angle_to 355.637 //
0731: set_car 0@ y_angle_to -0.00046618 //
00AB: put_car 0@ at 156.283 -313.079 2.58031 //
gosub @Enable_data_sent
wait 2500
for 17@ = 0 to 999
if 0AFF: samp 1@ = car_handle_by_samp_vehicle_id 17@
then
if
0137: car 1@ model == #ARTICT3
then
0175: set_car 1@ Z_angle_to 356.047
0731: set_car 1@ y_angle_to -0.00196721
00AB: put_car 1@ at 155.606 -322.524 2.15357
//repeat
0AF9: samp say_msg "/truckermission"
wait 300
0AF9: samp say_msg "1"
wait 2300
{gosub @checkpoint_coords // check distance
00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@ //
wait 0 //
0509: 3@ = distance_between_XY 4@ 5@ and_XY 11@ 12@ // check distance
if
0033: 1300.0 >= 3@
then
0AF9: samp say_msg "/stopmission" //stops the mission, removes checkpoint and respawns trailer
wait 500
0175: set_car 0@ Z_angle_to 179.856 //place truck on the right position again
0731: set_car 0@ y_angle_to 0.0426828 //
00AB: put_car 0@ at 2245.89 -2592.1 9.30011 //
wait 300
end
until 0021: 3@ > 1300.0 }
jump @First
end
end
end
print "No trailers around. Moving to 3rd place" time 1000
gosub @Disable_data_sent
wait 500 // move to 3rd place
0175: set_car 0@ Z_angle_to 313.826 //
0731: set_car 0@ y_angle_to -0.00027078 //
00AB: put_car 0@ at -1687.66 93.1461 4.54766 //
gosub @Enable_data_sent
wait 2500
for 17@ = 0 to 999
if 0AFF: samp 1@ = car_handle_by_samp_vehicle_id 17@
then
if
0137: car 1@ model == #ARTICT3
then
0175: set_car 1@ Z_angle_to 314.324
0731: set_car 1@ y_angle_to 0.0300106
00AB: put_car 1@ at -1694.45 86.5486 4.12843
//repeat
0AF9: samp say_msg "/truckermission"
wait 300
0AF9: samp say_msg "1"
wait 2300
{gosub @checkpoint_coords // check distance
00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@ //
wait 0 //
0509: 3@ = distance_between_XY 4@ 5@ and_XY 11@ 12@ // check distance
if
0033: 1300.0 >= 3@
then
0AF9: samp say_msg "/stopmission" //stops the mission, removes checkpoint and respawns trailer
wait 500
0175: set_car 0@ Z_angle_to 179.856 //place truck on the right position again
0731: set_car 0@ y_angle_to 0.0426828 //
00AB: put_car 0@ at 2245.89 -2592.1 9.30011 //
wait 300
end
until 0021: 3@ > 1300.0 }
jump @First
end
end
end
print "No trailers found at all 3 places" time 2000
jump @First
:activation //command /truck
wait 0
7@ = 1
Samp.CmdRet
:keyPress //cmd ret
if 0AA2: 2@ = load_library "User32.dll"
then
if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
then
0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
wait 1@
0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
end
end
0AB2: ret 0
:get3DXYZInFrontOf{X,Y,Z,ZA,YA,Distance} //cmd ret
3@ *= -1.0
02F6: 6@ = sine 3@
006B: 6@ *= 5@
005B: 0@ += 6@
02F7: 6@ = cosine 3@
006B: 6@ *= 5@
005B: 1@ += 6@
02F7: 6@ = cosine 4@
0073: 5@ /= 6@
02F6: 6@ = sine 4@
006B: 5@ *= 6@
005B: 2@ += 5@
0AB2: ret 3 0@ 1@ 2@
:checkpoint_coords //gosub
wait 0
0A8D: 11@ = read_memory 0x00C7E018 size 4 virtual_protect 0 // red marker X
11@ += 0x30 //
0A8D: 11@ = read_memory 11@ size 4 virtual_protect 0 //
0A8D: 12@ = read_memory 0x00C7E018 size 4 virtual_protect 0 // red marker Y
12@ += 0x34 //
0A8D: 12@ = read_memory 12@ size 4 virtual_protect 0 //
0A8D: 13@ = read_memory 0x00C7E018 size 4 virtual_protect 0 // red marker Z
13@ += 0x38 //
0A8D: 13@ = read_memory 13@ size 4 virtual_protect 0 //
return
:Disable_data_sent //gosub
wait 0
0B2E: 29@ = read_samp_memory offset 0x41E0 size 1 //onfoot
0B2E: 30@ = read_samp_memory offset 0x6140 size 1 //incar
//0B2E: 31@ = read_samp_memory offset 0x5750 size 2 //spec
0B2D: write_samp_memory offset 0x41E0 value 0xC3 size 1
0B2D: write_samp_memory offset 0x6140 value 0xC3 size 1
//0B2D: write_samp_memory offset 0x5750 value 0xC390 size 2
return
:Enable_data_sent //gosub
wait 0
0B2D: write_samp_memory offset 0x41E0 value 29@ size 1
0B2D: write_samp_memory offset 0x6140 value 30@ size 1
//0B2D: write_samp_memory offset 0x5750 value 31@ size 2
return