Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$CLEO}
- 0000: NOP
- 0B34: samp register_client_command "mow" to_label @activate
- //30@ = entrance switcher
- :First
- wait 0
- if 31@ == 1
- then
- if 00DF: actor $PLAYER_ACTOR driving
- then
- if 0AB1: @is_cp_active 0
- then
- 0811: 0@ = actor $PLAYER_ACTOR used_car
- 0AB1: call_scm_func @set_max_speed 2 car 0@ speedValue 10.0
- 0AB1: @get_cp_pos 0 1@ 2@ 3@
- 00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@
- 0AB1: call_scm_func @turning_mechanism 4 XY 1@ 2@ XY 4@ 5@ _returnedAngle 7@
- 0AB1: call_scm_func @check_for_block 3 car 0@ angle 7@ blocks 29@ _returned blocks 29@
- //check for things infront of me
- // 4@ 5@ 6@ = my position
- 9@ = 1.0
- 02E3: 8@ = car 0@ speed
- 006B: 9@ *= 8@ // distance depending on the speed
- 0174: 15@ = car 0@ Z_angle
- 077D: 8@ = car 0@ x_angle
- 0AB1: call_scm_func @z_angles 1 angle 15@ _returnedAngles 14@ 16@ //14@ 15@ 16@ are the angles to detect any obstacles
- 0AB1: call_scm_func @x_angle_correction 1 angle 8@ _returnedAngle 8@ //to avoid false obstacles (detecting ground as obstacle) due to bumpy surface
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 14@ Y_Angle 8@ Distance 9@ _returnedStatus 10@ //draws line and checks for obstacles, 10@ == 1 indicates obstacle, 10@ == 0 indicates free space
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 15@ Y_Angle 8@ Distance 9@ _returnedStatus 11@
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 16@ Y_Angle 8@ Distance 9@ _returnedStatus 12@
- if or
- 10@ == 1
- 11@ == 1
- 12@ == 1
- then
- 33@ = 0
- repeat
- wait 0
- if 0033: 180.0 >= 7@
- then
- 0B56: set_game_key 0 state 255 //press right
- else
- 0B56: set_game_key 0 state -255 //press left
- end
- 0B56: set_game_key 16 state 255 //accelerate
- until 33@ > 800
- 0B56: set_game_key 0 state 0
- 33@ = 0
- repeat
- wait 0
- 0B56: set_game_key 16 state 255
- until 33@ > 600
- end
- //end of check
- //check for other side (to avoid water)
- //my position x=4@ y=5@
- //marker mosition x=1@ y=2@
- if and
- 0023: 1966.0 > 4@ //if I'm on the left side
- 0021: 1@ > 1966.0 //if the marker is on the right side
- then
- if 0023: -1197.0 > 5@ //if i'm at the bottom
- then
- 1@ = 1936.0 //to 1990.0
- 2@ = -1239.0 //to -1232.0
- 30@ = 1
- else
- 1@ = 1937.0 //to 1992.0
- 2@ = -1157.0 //to -1157.0
- 30@ = 2
- end
- jump @Change_Side
- end
- if and
- 0023: 1966.0 > 1@ //if the marker is on the left side
- 0021: 4@ > 1966.0 //if I'm on the right side
- then
- if 0023: -1197.0 > 5@ //if i'm at the bottom
- then
- 1@ = 1997.0 // 1943.0
- 2@ = -1232.0 // -1239.0
- 30@ = 4
- else
- 1@ = 1999.0 // 1944.0
- 2@ = -1157.0 // -1157.0
- 30@ = 5
- end
- jump @Change_Side
- end
- //end of check
- end
- end
- end
- if key_down 48
- then
- 31@ = 0
- end
- jump @First
- :Change_Side
- wait 0
- if 31@ == 1
- then
- if 00DF: actor $PLAYER_ACTOR driving
- then
- if 0AB1: @is_cp_active 0
- then
- 0811: 0@ = actor $PLAYER_ACTOR used_car
- 0AB1: call_scm_func @set_max_speed 2 car 0@ speedValue 10.0
- 00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@
- 0509: 3@ = distance_between_XY 1@ 2@ and_XY 4@ 5@
- if 0023: 2.0 > 3@ //if i'm at the entrance
- then
- if 30@ == 1
- then
- 1@ = 1990.0
- 2@ = -1233.5
- 30@ = 3 //switcher indicate that I arrived to the first point of entrance and now I'm going to the other side
- else
- if 30@ == 2
- then
- 1@ = 1992.0
- 2@ = -1159.5
- 30@ = 3
- else
- if 30@ == 4
- then
- 1@ = 1943.0
- 2@ = -1241.5
- 30@ = 6
- else
- if 30@ == 5
- then
- 1@ = 1944.0
- 2@ = -1158.5
- 30@ = 6
- else
- if 30@ == 6 //if I arrived succesfully (going to the left)
- then
- jump @First
- else
- if 30@ == 3 //if I arrived succesfully (going to the right)
- then
- jump @First
- end
- end
- end
- end
- end
- end
- end
- 0AB1: call_scm_func @turning_mechanism 4 XY 1@ 2@ XY 4@ 5@ _returnedAngle 7@
- if or
- 30@ == 1
- 30@ == 2
- 30@ == 4
- 30@ == 5
- then
- //check for block
- 0AB1: call_scm_func @check_for_block 3 car 0@ angle 7@ blocks 29@ _returned blocks 29@
- //end of the block
- //check for things infront of me
- // 4@ 5@ 6@ = my position
- 9@ = 1.0
- 02E3: 8@ = car 0@ speed
- 006B: 9@ *= 8@ // distance depending on the speed
- 0174: 15@ = car 0@ Z_angle
- 077D: 8@ = car 0@ x_angle
- 0AB1: call_scm_func @z_angles 1 angle 15@ _returnedAngles 14@ 16@ //14@ 15@ 16@ are the angles to detect any obstacles
- 0AB1: call_scm_func @x_angle_correction 1 angle 8@ _returnedAngle 8@
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 14@ Y_Angle 8@ Distance 9@ _returnedStatus 10@
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 15@ Y_Angle 8@ Distance 9@ _returnedStatus 11@
- 0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 16@ Y_Angle 8@ Distance 9@ _returnedStatus 12@
- if or
- 10@ == 1
- 11@ == 1
- 12@ == 1
- then
- 33@ = 0
- repeat
- wait 0
- if 0033: 180.0 >= 7@
- then
- 0B56: set_game_key 0 state 255 //press right
- else
- 0B56: set_game_key 0 state -255 //press left
- end
- 0B56: set_game_key 16 state 255
- until 33@ > 800
- 0B56: set_game_key 0 state 0
- 33@ = 0
- repeat
- wait 0
- 0B56: set_game_key 16 state 255
- until 33@ > 600
- end
- //end of check
- end
- end
- end
- end
- if key_down 48
- then
- 31@ = 0
- end
- jump @Change_Side
- :activate
- 0B12: 31@ = 31@ XOR 1
- samp.CmdRet
- //0AB1: call_scm_func @set_max_speed 2 car 0@ speedValue 10.0
- :set_max_speed
- 02E3: 31@ = car 0@ speed
- if 0025: 31@ > 1@ // (float)
- then
- 04BA: set_car 0@ speed_to 1@
- end
- 0AB2: ret 0
- //0AB1: call_scm_func @obstacle_line 6 XYZ 4@ 5@ 6@ Z_Angle 14@ Y_Angle 8@ Distance 9@ _returnedStatus @
- :obstacle_line
- 03F0: enable_text_draw 1
- 0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 0@ 1@ 2@ Z_Angle 3@ Y_Angle 4@ Distance 5@ Return_XYZ_To 3@ 4@ 5@
- 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 3@ 4@ 5@ store_screen_X_to 20@ Y_to 21@
- 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ 1@ 2@ store_screen_X_to 22@ Y_to 23@
- if 06BD: no_obstacles_between 3@ 4@ 5@ and 0@ 1@ 2@ solid 1 car 0 actor 1 object 1 particle 0
- then
- 0AB1: call_scm_func @drawLine 9 x1y1 20@ 21@ x2y2 22@ 23@ thickness 1.0 R 255 G 255 B 255 A 255 //no obstacle /white line
- 31@ = 0
- else
- 0AB1: call_scm_func @drawLine 9 x1y1 20@ 21@ x2y2 22@ 23@ thickness 1.0 R 255 G 0 B 0 A 255 //no obstacle /red line
- 31@ = 1
- end
- 0AB2: ret 1 31@
- //0AB1: call_scm_func @check_for_block 3 car 0@ angle 7@ blocks 29@ _returned blocks 29@
- :check_for_block
- 02E3: 31@ = car 0@ speed
- if 0033: 0.4 >= 31@
- then
- 2@ += 1
- if 2@ > 7
- then
- 2@ = 0
- 0AB1: call @keyPress 2 key 83 time 1500 //s
- 33@ = 0
- wait 1500
- repeat
- wait 0
- if 0033: 180.0 >= 1@
- then
- 0B56: set_game_key 0 state 255 //press right
- else
- 0B56: set_game_key 0 state -255 //press left
- end
- 0B56: set_game_key 16 state 255
- until 33@ > 900
- 0B56: set_game_key 0 state 0
- 33@ = 0
- repeat
- wait 0
- 0B56: set_game_key 16 state 255
- until 33@ > 900
- end
- end
- 0AB2: ret 1 2@
- //0AB1: call_scm_func @turning_mechanism 4 XY XY _returnedAngle 1@
- :turning_mechanism
- 0AB1: @getZAngleBetweenPoints 4 from_XY 0@ 1@ and_XY 2@ 3@ store_to 31@
- 0172: 30@ = actor $PLAYER_ACTOR Z_angle
- 30@ -= 360.0
- 0097: make 30@ absolute_float
- 005B: 31@ += 30@
- 02F6: 30@ = sine 31@
- 02F7: 31@ = cosine 31@
- 0604: get_Z_angle_for_point 30@ 31@ store_to 31@
- if and
- 0021: 31@ > 180.0
- 0023: 355.0 > 31@
- then //press left
- 0B56: set_game_key 0 state -255
- 0B56: set_game_key 16 state 255
- if
- 0023: 200.0 > 31@
- then
- 0B56: set_game_key 6 state 255
- else
- 0B56: set_game_key 6 state 0
- end
- else
- if and
- 0021: 31@ > 5.0
- 0033: 180.0 >= 31@ //lower or equal
- then //press right
- 0B56: set_game_key 0 state 255
- 0B56: set_game_key 16 state 255
- if
- 0021: 31@ > 160.0
- then
- 0B56: set_game_key 6 state 255
- else
- 0B56: set_game_key 6 state 0
- end
- else
- 0B56: set_game_key 0 state 0
- 0B56: set_game_key 6 state 0
- 0B56: set_game_key 16 state 255
- end
- end
- 0AB2: ret 1 31@
- //0AB1: call_scm_func @z_angles 1 angle 0@ _returnedAngles 1@ 2@
- :z_angles
- 0087: 1@ = 0@ // (float)
- 0@ -= 5.0
- 1@ += 5.0
- if 0021: 1@ > 360.0
- then
- 1@ -= 360.0
- end
- if 0023: 0.0 > 0@
- then
- 0@ += 360.0
- end
- 0AB2: ret 2 0@ 1@
- //0AB1: call_scm_func @x_angle_correction 1 angle 0@ _returnedAngle 1@
- :x_angle_correction
- if and
- 0021: 0@ > 0.0
- 0023: 90.0 > 0@
- then
- 0@ += 15.0
- else
- if
- 0021: 0@ > 270.0
- then
- 0@ += 15.0
- if
- 0021: 0@ > 360.0
- then
- 0@ -= 360.0
- end
- end
- end
- 0AB2: ret 1 0@
- :keyPress
- // 0@ - key, 1@ - time
- // Example: 0AB1: call @keyPress 2 key 0@ time 1@
- 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
- {
- 0 left/right ~k~~VEHICLE_STEERLEFT~/ ~k~~VEHICLE_STEERRIGHT~
- 1 steer back/up ~k~~VEHICLE_STEERUP~/ ~k~~VEHICLE_STEERDOWN~
- 2 special ctrl left/right ~k~~VEHICLE_TURRETLEFT~/ ~k~~VEHICLE_TURRETRIGHT~ (NUM6)
- 3 special control up/down ~k~~VEHICLE_TURRETUP~/ ~k~~VEHICLE_TURRETDOWN~
- 4 secondary fire ~k~~VEHICLE_FIREWEAPON_ALT~
- 5 look left ~k~~VEHICLE_LOOKLEFT~
- 6 hand brake ~k~~VEHICLE_HANDBRAKE~
- 7 look right ~k~~VEHICLE_LOOKRIGHT~
- 8 next radio station ~k~~VEHICLE_RADIO_STATION_UP~
- 9 previous radio station ~k~~VEHICLE_RADIO_STATION_DOWN~
- 10 no ~k~~CONVERSATION_NO~
- 11 yes / trip skip ~k~~CONVERSATION_YES~
- 12 (does not exist) -- -- --
- 13 camera ~k~~CAMERA_CHANGE_VIEW_ALL_SITUATIONS~
- 14 brake/reserve ~k~~VEHICLE_BRAKE~
- 15 enter/exit ~k~~VEHICLE_ENTER_EXIT~
- 16 accelerate ~k~~VEHICLE_ACCELERATE~
- 17 fire ~k~~VEHICLE_FIREWEAPON~
- 18 horn ~k~~VEHICLE_HORN~
- 19 submission ~k~~TOGGLE_SUBMISSIONS~
- }
- :is_cp_active
- IF 0AA2: 0@ = loadlib "samp.dll"
- THEN 0A8E: 1@ = 0@ + 0x212A94
- 0A8D: 1@ = readMem 1@ sz 4 vp 0
- 1@ += 0x24
- 0A8D: 1@ = readMem 1@ sz 4 vp 0
- IF 1@ == TRUE
- THEN 0485: return_true
- ELSE 059A: return_false
- END
- 0AA3: freelib 0@
- END
- 0AB2: ret 0
- :get_cp_pos
- IF 0AA2: 0@ = loadlib "samp.dll"
- THEN 0A8E: 1@ = 0@ + 0x212A94
- 0A8D: 1@ = readMem 1@ sz 4 vp 0
- 1@ += 0xC
- 0A8D: 2@ = readMem 1@ sz 4 vp 0
- 1@ += 0x4
- 0A8D: 3@ = readMem 1@ sz 4 vp 0
- 1@ += 0x4
- 0A8D: 4@ = readMem 1@ sz 4 vp 0
- 0AA3: freelib 0@
- END
- 0AB2: ret 3 2@ 3@ 4@
- :getZAngleBetweenPoints
- 0063: 0@ -= 2@
- 0063: 1@ -= 3@
- 0604: get_Z_angle_for_point 0@ 1@ store_to 4@
- 0AB2: 1 4@
- :get3DXYZInFrontOf{X,Y,Z,ZA,YA,Distance}
- {
- Return:
- PosX-InFrontOf
- PosY-InFrontOf
- PosZ-InFrontOf
- Example: 0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 1@ 2@ 3@ Z_Angle 4@ Y_Angle 5@ Distance 7.0 Return_XYZ_To 6@ 7@ 8@
- }
- 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@
- //0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
- :getScreenXYFrom3DCoords
- 0AA7: call_function 0x70CE30 num_params 6 pop 6 clipNear 1 clipFar 1 yMult 7@s xMult 6@s outVector 2@s inVector 0@s result 29@
- 0073: 2@ /= 6@
- 0073: 2@ /= 4@
- 0073: 3@ /= 7@
- 0073: 3@ /= 4@
- 2@ *= 640.0
- 3@ *= 448.0
- 0AB2: ret 2 2@ 3@
- :drawLine
- //0AB1: call_scm_func drawLine 9 x1y1 0@ 1@ x2y2 2@ 3@ thickness 1.0 R 255 G 255 B 255 A 255
- 0390: load_txd_dictionary 'LD_DUAL'
- 038F: load_texture "white" as 300
- 0509: 9@ = distance_between_XY 0@ 1@ and_XY 2@ 3@
- 0063: 2@ -= 0@
- 0063: 3@ -= 1@
- 0604: get_Z_angle_for_point 2@ 3@ store_to 10@
- 10@ += 90.0
- 0017: 2@ /= 2.0
- 0017: 3@ /= 2.0
- 005B: 0@ += 2@
- 005B: 1@ += 3@
- 074B: draw_texture 300 position 0@ 1@ scale 9@ 4@ angle 10@ color_RGBA 5@ 6@ 7@ 8@
- 0391: release_textures
- 0AB2: ret 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement