skatefilter5 Posted August 8, 2017 Share Posted August 8, 2017 (edited) When I press a key as enter passager seat to the nearest car it didn't work or it crashes, I couldn't get the car and ped from the road path, it there a better way to fix this? {$CLEO .cs} //-------------MAIN--------------- 0000: NOP :NONAME_2 wait 0 if Player.Defined($PLAYER_CHAR) else_jump @NONAME_2 jump @NONAME_45 [email protected] = 1 [email protected] = 1 :NONAME_45 wait 0 Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected]) 073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected] 08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 10.0 handle_as [email protected] if and 00E1: player 0 pressed_key 11 not Actor.Driving($PLAYER_ACTOR) 056E: car [email protected] defined 056D: actor [email protected] defined else_jump @NONAME_45 Car.Health([email protected]) = 3000 039E: set_actor [email protected] locked 1 while_in_car 0982: set_actor [email protected] stay_in_car_when_dead 1 05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 2 time 6000 wait 6000 :NONAME_175 wait 0 if Actor.InCar($PLAYER_ACTOR, [email protected]) else_jump @NONAME_175 Car.SetToNormalDriver([email protected]) wait 2000 Car.RemoveReferences([email protected]) jump @NONAME_45 Edited August 9, 2017 by skatefilter5 Link to comment Share on other sites More sharing options...
spaceeinstein Posted August 8, 2017 Share Posted August 8, 2017 (edited) "end_thread" is not allowed in a CLEO script. Why do you want to end it at all? Edited August 8, 2017 by spaceeinstein Link to comment Share on other sites More sharing options...
skatefilter5 Posted August 9, 2017 Author Share Posted August 9, 2017 (edited) "end_thread" is not allowed in a CLEO script. Why do you want to end it at all? Well, since the the game crashes when I press conversion yes key on enter as a passanger, because 073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected] isn't wokring so I decide to put end_thread to block this script that crashes when I have over 1000 cleo scripts and that crashing script is hard to find sometimes Edited August 9, 2017 by skatefilter5 Link to comment Share on other sites More sharing options...
Guest Posted August 12, 2017 Share Posted August 12, 2017 (edited) Why [email protected] and [email protected] are set to 1? This value is potentially an valid handle, consequentially handling a unexpected entity. Instead of the opcodes 0x073E and 0x08E5, you can use opcode 0x0AB5 to store the closest vehicle and chara. You can use opcode 0x046C to get the vehicle's driver instead of "try to find" them in scenario. It's a safe and accurated way to do this. Of curse, only entities generated by script have references to be removed. Do not fill up the code with severals WAITs, because this unnecessarily delays the curse of script. And more important: the handles should be verified after each WAIT. Others scripts, for example, can destroy the handled entity and invalidate the handle, causing crashes. Edited August 12, 2017 by Guest Link to comment Share on other sites More sharing options...
skatefilter5 Posted August 12, 2017 Author Share Posted August 12, 2017 Why [email protected] and [email protected] are set to 1? This value is potentially an valid handle, consequentially handling a unexpected entity. Instead of the opcodes 0x073E and 0x08E5, you can use opcode 0x0AB5 to store the closest vehicle and chara. You can use opcode 0x046C to get the vehicle's driver instead of "try to find" them in scenario. It's a safe and accurated way to do this. Of curse, only entities generated by script have references to be removed. Do not fill up the code with severals WAITs, because this unnecessarily delays the curse of script. And more important: the handles should be verified after each WAITs. Others scripts, for example, can destroy the handled entity and invalidate the handle, causing crashes. I haven't seen the alternated code but I'll try that one then Link to comment Share on other sites More sharing options...
skatefilter5 Posted August 18, 2017 Author Share Posted August 18, 2017 The second problem, that if i sit in car as a passenger the driver is not doing anything, not driving random or go to waypoint, he's just sitting there doing nothing, even removing actor.RemoveReferences and car.RemoveReferences also don't work because it just still stand there and do nothing. {$CLEO .cs} //-------------MAIN--------------- 0000: NOP 0ACD: show_text_highpriority "Press ~n~~k~~CONVERSATION_YES~ to sit as a passanger." time 3600 //wait 1000 //0ACC: show_text_lowpriority "Near a car." time 3000 :NONAME_2 wait 0 if //0ADC: test_cheat "passanger" Player.Defined($PLAYER_CHAR) else_jump @NONAME_2 jump @NONAME_45 [email protected] = 1 [email protected] = 1 :NONAME_45 wait 0 Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected]) 0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] 0AB6: store_target_marker_coords_to [email protected] [email protected] [email protected] // IF and SET jump @CAR :Remove wait 0 //Car.RemoveReferences([email protected]) //actor.RemoveReferences([email protected]) jump @NONAME_45 :CAR wait 0 if and 00E1: player 0 pressed_key 11 //Press Y or N I think not Actor.Driving($PLAYER_ACTOR) 056E: car [email protected] defined 056D: actor [email protected] defined else_jump @NONAME_45 Car.SetMaxSpeed([email protected], 0.0) jf @CAR if 0203: actor $PLAYER_ACTOR near_car [email protected] radius 5.0 5.0 flag 0 on_foot else_jump @CAR Car.Health([email protected]) = 3000 039E: set_actor [email protected] locked 1 while_in_car 0982: set_actor [email protected] stay_in_car_when_dead 1 05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 2 time 10000 wait 500 :NONAME_175 wait 0 if Actor.InCar($PLAYER_ACTOR, [email protected]) else_jump @Remove //jump @Cancel car.SetSpeedInstantly([email protected], 20.0) Car.SetMaxSpeed([email protected], 50.0) car.DriveTo([email protected], [email protected], [email protected], [email protected]) //00AE: set_car [email protected] traffic_behaviour_to 3 //Car.SetToNormalDriver([email protected]) 00A8: set_car [email protected] to_psycho_driver 00AF: set_car [email protected] driver_behaviour_to 5 wait 1000 //Car.RemoveReferences([email protected]) //actor.RemoveReferences(1[email protected]) jump @NONAME_45 Link to comment Share on other sites More sharing options...
deltaCJ Posted August 18, 2017 Share Posted August 18, 2017 Um, the driver isn't going to go to a set of marker coordinates if you never placed down the marker in your map. Target_Marker opcode isn't random at all. Place down a marker on your map and try this then. Link to comment Share on other sites More sharing options...
skatefilter5 Posted August 19, 2017 Author Share Posted August 19, 2017 Um, the driver isn't going to go to a set of marker coordinates if you never placed down the marker in your map. Target_Marker opcode isn't random at all. Place down a marker on your map and try this then. I already test that with the marker placed and the driver still not moving, well instead of taking from cars and peds on the traffic, I have create a new one then, mostly taxi, call and make him drive to the target marker. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now