szczypior Posted August 1, 2017 Share Posted August 1, 2017 (edited) It's possible to do script with label which don't have to be used for finish script, but can be used till end of script? For example (check :00000 and :11111) :1wait 0 car.Create([email protected], #TAMPA, x, y, z)car.Health([email protected]) = 400jump @2:2 wait 0 if 00DB: actor $PLAYER_ACTOR in_car [email protected] jump @2marker.CreateIconAndSphere([email protected], 1, x1, y1, z1)jump @3// make those able to do, till the end of a script :00000wait 0 if and 00DB: actor $PLAYER_ACTOR in_car [email protected]: key_pressed 0x73else jump @111110A30: repair_car [email protected] @00000:11111wait 0 if and00DB: actor $PLAYER_ACTOR in_car [email protected]: key_pressed 0x74010F: player $PLAYER_CHAR wanted_level > 0else_jump @000000110: clear_player $PLAYER_CHAR wanted_leveljump @11111:3wait 0if car.Wrecked([email protected])else_jump @4marker.Disable([email protected])car.RemoveReferences([email protected])jump @1:4if 01B0: car [email protected] sphere 0 in_sphere x1 y1 z1 radius 4.0 4.0 4.0 stoppedelse_jump @3marker.Disable([email protected])car.RemoveReferences([email protected])0109: player $PLAYER_CHAR money += 100 Edited August 1, 2017 by szczypior Link to comment Share on other sites More sharing options...
kosticn101 Posted August 1, 2017 Share Posted August 1, 2017 (edited) It's probably good idea to learn high level structures. I demonstrated here if..then..end. {$CLEO}0000:const VK_F4 = 0x73 VK_F5 = 0x74 //garage in San Fierro DEST_X = -2015.9745 DEST_Y = 172.9583 DEST_Z = 27.6875 end:beginningwait 0if 0256: player $PLAYER_CHAR definedelse_jump @beginning:load_modelwait 00247: load_model #TAMPAif 0248: model #TAMPA availableelse_jump @load_modelcar.Create([email protected], #TAMPA, -2016.0109, 159.9356, 27.6875)0249: release_model #TAMPAcar.Health([email protected]) = 400:wait_carwait 0if 00DB: actor $PLAYER_ACTOR in_car [email protected]_jump @wait_carmarker.CreateIconAndSphere([email protected], 1, DEST_X, DEST_Y, DEST_Z):loopwait 0if or 8256: not player $PLAYER_CHAR defined car.Wrecked([email protected])then marker.Disable([email protected]) car.RemoveReferences([email protected]) jump @beginningendif and 00DB: actor $PLAYER_ACTOR in_car [email protected] 0AB0: key_pressed VK_F4then 0A30: repair_car [email protected] and 00DB: actor $PLAYER_ACTOR in_car [email protected] 0AB0: key_pressed VK_F5 010F: player $PLAYER_CHAR wanted_level > 0then 0110: clear_player $PLAYER_CHAR wanted_levelendif 01B0: car [email protected] sphere 0 in_sphere DEST_X DEST_Y DEST_Z radius 4.0 4.0 4.0 stoppedelse_jump @loopmarker.Disable([email protected])car.RemoveReferences([email protected])0109: player $PLAYER_CHAR money += 1000A93: end_custom_thread Edited August 1, 2017 by kosticn101 szczypior 1 Link to comment Share on other sites More sharing options...
szczypior Posted August 1, 2017 Author Share Posted August 1, 2017 Is this script repeatable or Not? Link to comment Share on other sites More sharing options...
kosticn101 Posted August 1, 2017 Share Posted August 1, 2017 Do you mean does it starts all over again after you finish the mission? No. Link to comment Share on other sites More sharing options...
szczypior Posted August 1, 2017 Author Share Posted August 1, 2017 Can script like this be repeatable? Link to comment Share on other sites More sharing options...
kosticn101 Posted August 1, 2017 Share Posted August 1, 2017 (edited) I don't understand what are you asking, but I've spotted some errors. We are not checking is player defined. Player is not defined if he is wasted or busted. I've edited the code. + 0256: player $PLAYER_CHAR defined I'm asking is player defined + 8256: not player $PLAYER_CHAR defined I'm asking is player not defined If you are asking how to start a mission again after you finish it, just add jump @beginning before 0A93: end_custom_thread. I forgot to release a Tampa model after creating a car. It's good idea to free memory. I've edited the code again. Edited August 1, 2017 by kosticn101 szczypior 1 Link to comment Share on other sites More sharing options...
szczypior Posted August 1, 2017 Author Share Posted August 1, 2017 (edited) I was asking about starting mission again and again sure u spotted some errors because it was example, not a real code, now I tried the way you show me and once, it didnt work properly and second time game freeze at loading screen Edited August 1, 2017 by szczypior Link to comment Share on other sites More sharing options...
kosticn101 Posted August 1, 2017 Share Posted August 1, 2017 (edited) Working completely fine for me. You need to stop the car inside marker, not just to pass through it. Also no freezing on loading screen. Have you modified the code? And when you want to repeat a mission, you need to enter new car that is created, it will not work with the old car. Edited August 1, 2017 by kosticn101 szczypior 1 Link to comment Share on other sites More sharing options...
madleg Posted August 1, 2017 Share Posted August 1, 2017 (edited) firstly if you want to "insert" 000 and 111 then fix its sintax to be like :xxx if and conditions else_junp @return ...stuff if true jump @return where @return is return :return return secondary: use gosub to execute this labels in your continuous loop :3 wait 0 gosub @000 gosub @111 ... rest of your stuff but as was mentioned: the best way to use label constructions - to not use them Edited August 1, 2017 by madleg szczypior 1 Link to comment Share on other sites More sharing options...
szczypior Posted August 1, 2017 Author Share Posted August 1, 2017 (edited) Working completely fine for me. You need to stop the car inside marker, not just to pass through it. Also no freezing on loading screen. Have you modified the code? And when you want to repeat a mission, you need to enter new car that is created, it will not work with the old car. just coords, its little buggy because there should be 00ED: actor $PLAYER_ACTOR sphere 0 near_point -2016.0109 159.9356 radius 4.0 4.0 on_foot before car.Create([email protected], #TAMPA, -2016.0109, 159.9356, 27.6875) but now works fine firstly if you want to "insert" 000 and 111 then fix its sintax to be like :xxx if and conditions else_junp @return ...stuff if true jump @return where @return is return :return return secondary: use gosub to execute this labels in your continuous loop :3 wait 0 gosub @000 gosub @111 ... rest of your stuff but as was mentioned: the best way to use label constructions - to not use them I'll try this too btw, thanks you both Edited August 1, 2017 by szczypior kosticn101 1 Link to comment Share on other sites More sharing options...
szczypior Posted August 1, 2017 Author Share Posted August 1, 2017 So now, I tried something another, but its full of bugs {$CLEO .cs}0000: NOP:1wait 0if0256: player $PLAYER_CHAR definedelse_jump @1:2wait 0model.Load(#CELLPHONE)model.Load(#FAM4)038B: load_requested_modelsif andmodel.Available(#CELLPHONE)model.Available(#FAM4)0AB0: key_pressed 80else_jump @20729: AS_actor $PLAYER_ACTOR hold_cellphone 1wait 40000729: AS_actor $PLAYER_ACTOR hold_cellphone 0wait 200jump @3:3wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 80.0 80.0else_jump @12wait 100actor.Create([email protected], Gang2, #FAM4, 206.9569, -1771.0079, 4.2997)02E2: set_actor [email protected] weapon_accuracy_to 90actor.Health([email protected]) = 400jump @15:12wait 0 if oractor.Dead([email protected])0741: actor $PLAYER_ACTOR bustedactor.Dead($PLAYER_ACTOR)else_jump @3actor.RemoveReferences([email protected])jump @1:15wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0then 07AF: [email protected] = player $PLAYER_CHAR group 0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader 0631: put_actor [email protected] in_group [email protected] marker.CreateAboveActor([email protected],[email protected]) marker.SetColor([email protected], 1) 018B: set_marker [email protected] radar_mode 2 wait 1500 03BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0end if or 0741: actor $PLAYER_ACTOR bustedactor.Dead($PLAYER_ACTOR)actor.Dead([email protected])then 0632: release_group [email protected] actor.RemoveReferences([email protected]) 0164: disable_marker [email protected] 03BD: destroy_sphere [email protected] jump @1 end :4if 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stoppedelse_jump @150632: release_group [email protected]: disable_marker [email protected]: destroy_sphere [email protected]([email protected])jump @10A93: end_custom_thread maybe because its too complicated? Link to comment Share on other sites More sharing options...
deltaCJ Posted August 2, 2017 Share Posted August 2, 2017 are you trying to make it so if you pass that mission, you get another mission? Or you just want it to create the sphere again after you pass it. Link to comment Share on other sites More sharing options...
kosticn101 Posted August 2, 2017 Share Posted August 2, 2017 (edited) if andmodel.Available(#CELLPHONE)model.Available(#FAM4)0AB0: key_pressed 80else_jump @2 You should put 0AB0: key_pressed 80 in it's own if down below. :3wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 80.0 80.0else_jump @12wait 100actor.Create([email protected], Gang2, #FAM4, 206.9569, -1771.0079, 4.2997)02E2: set_actor [email protected] weapon_accuracy_to 90actor.Health([email protected]) = 400jump @15:12wait 0 if oractor.Dead([email protected]) //------this actor hasn't been created yet0741: actor $PLAYER_ACTOR bustedactor.Dead($PLAYER_ACTOR)else_jump @3actor.RemoveReferences([email protected]) //------this actor hasn't been created yetjump @1 :15wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0then 07AF: [email protected] = player $PLAYER_CHAR group 0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader 0631: put_actor [email protected] in_group [email protected] marker.CreateAboveActor([email protected],[email protected]) marker.SetColor([email protected], 1) 018B: set_marker [email protected] radar_mode 2 wait 1500 03BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0end.........:4if 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stoppedelse_jump @15 So you're executing this code: 07AF: [email protected] = player $PLAYER_CHAR group0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader0631: put_actor [email protected] in_group [email protected]([email protected],[email protected])marker.SetColor([email protected], 1)018B: set_marker [email protected] radar_mode 2wait 150003BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0 again and again and again. Label :15 is misplaced, should be below that if. Also :wait_actorwait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0else_jump @wait_actor //probably a good idea to check if actor or player is dead or busted maybe because its too complicated? Yes it's too complicated, if you love labels that much you should at least try to give them a meaningful name and stop using meaningless numbers. Here is how I would write this (edited): {$CLEO .cs}0000: NOPconst VK_KEY_P = 80end:beginningwait 0if 0256: player $PLAYER_CHAR definedelse_jump @beginning:model_loadwait 0model.Load(#CELLPHONE)model.Load(#FAM3) //-------I don't have FAM4038B: load_requested_modelsif and model.Available(#CELLPHONE) model.Available(#FAM3)else_jump @model_loadrepeat wait 0until 0AB0: key_pressed VK_KEY_P/*so this is same as// :phone// wait 0// if 0AB0: key_pressed VK_KEY_P// else_jump @phonebut in repeat..until you can put only one condition,there is no "until and" or "until or"*/ 0729: AS_actor $PLAYER_ACTOR hold_cellphone 1wait 40000729: AS_actor $PLAYER_ACTOR hold_cellphone 0wait 200repeat wait 0 if 0256: player $PLAYER_CHAR defined else_jump @beginninguntil 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 80.0 80.0wait 100actor.Create([email protected], Gang2, #FAM3, 206.9569, -1771.0079, 4.2997)02E2: set_actor [email protected] weapon_accuracy_to 90actor.Health([email protected]) = 400repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then actor.RemoveReferences([email protected]) jump @beginning enduntil 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.007AF: [email protected] = player $PLAYER_CHAR group0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader0631: put_actor [email protected] in_group [email protected]([email protected],[email protected])marker.SetColor([email protected], 1)018B: set_marker [email protected] radar_mode 2wait 150003BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then gosub @cleanup //-----1 actor.RemoveReferences([email protected]) jump @beginning end until 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stoppedgosub @cleanup //------2//basically, I don't want to write same code two times, that's why I'm using gosubactor.DestroyWithFade([email protected])jump @beginning0A93: end_custom_thread:cleanup0632: release_group [email protected]: disable_marker [email protected]: destroy_sphere [email protected] //"jump back" It's good idea to release models at the some point. Edited August 2, 2017 by kosticn101 szczypior 1 Link to comment Share on other sites More sharing options...
szczypior Posted August 2, 2017 Author Share Posted August 2, 2017 (edited) are you trying to make it so if you pass that mission, you get another mission? Or you just want it to create the sphere again after you pass it.Yes, I tried to make this mission repeatable, at least now, because I always want to check everything and dont want to start the game over and over Edited August 2, 2017 by szczypior Link to comment Share on other sites More sharing options...
szczypior Posted August 2, 2017 Author Share Posted August 2, 2017 if andmodel.Available(#CELLPHONE)model.Available(#FAM4)0AB0: key_pressed 80else_jump @2 You should put 0AB0: key_pressed 80 in it's own if down below. :3wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 80.0 80.0else_jump @12wait 100actor.Create([email protected], Gang2, #FAM4, 206.9569, -1771.0079, 4.2997)02E2: set_actor [email protected] weapon_accuracy_to 90actor.Health([email protected]) = 400jump @15:12wait 0 if oractor.Dead([email protected]) //------this actor hasn't been created yet0741: actor $PLAYER_ACTOR bustedactor.Dead($PLAYER_ACTOR)else_jump @3actor.RemoveReferences([email protected]) //------this actor hasn't been created yetjump @1 :15wait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0then 07AF: [email protected] = player $PLAYER_CHAR group 0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader 0631: put_actor [email protected] in_group [email protected] marker.CreateAboveActor([email protected],[email protected]) marker.SetColor([email protected], 1) 018B: set_marker [email protected] radar_mode 2 wait 1500 03BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0end.........:4if 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stoppedelse_jump @15 So you're executing this code: 07AF: [email protected] = player $PLAYER_CHAR group0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader0631: put_actor [email protected] in_group [email protected]([email protected],[email protected])marker.SetColor([email protected], 1)018B: set_marker [email protected] radar_mode 2wait 150003BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0 again and again and again. Label :15 is misplaced, should be below that if. Also :wait_actorwait 0if 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0else_jump @wait_actor //probably a good idea to check if actor or player is dead or busted maybe because its too complicated? Yes it's too complicated, if you love labels that much you should at least try to give them a meaningful name and stop using meaningless numbers. Here is how I would write this (edited): {$CLEO .cs}0000: NOPconst VK_KEY_P = 80end:beginningwait 0if 0256: player $PLAYER_CHAR definedelse_jump @beginning:model_loadwait 0model.Load(#CELLPHONE)model.Load(#FAM3) //-------I don't have FAM4038B: load_requested_modelsif and model.Available(#CELLPHONE) model.Available(#FAM3)else_jump @model_loadrepeat wait 0until 0AB0: key_pressed VK_KEY_P/*so this is same as// :phone// wait 0// if 0AB0: key_pressed VK_KEY_P// else_jump @phonebut in repeat..until you can put only one condition,there is no "until and" or "until or"*/ 0729: AS_actor $PLAYER_ACTOR hold_cellphone 1wait 40000729: AS_actor $PLAYER_ACTOR hold_cellphone 0wait 200repeat wait 0 if 0256: player $PLAYER_CHAR defined else_jump @beginninguntil 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 80.0 80.0wait 100actor.Create([email protected], Gang2, #FAM3, 206.9569, -1771.0079, 4.2997)02E2: set_actor [email protected] weapon_accuracy_to 90actor.Health([email protected]) = 400repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then actor.RemoveReferences([email protected]) jump @beginning enduntil 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.007AF: [email protected] = player $PLAYER_CHAR group0630: put_actor $PLAYER_ACTOR in_group [email protected] as_leader0631: put_actor [email protected] in_group [email protected]([email protected],[email protected])marker.SetColor([email protected], 1)018B: set_marker [email protected] radar_mode 2wait 150003BC: [email protected] = create_sphere_at 206.9569 -1771.0079 4.2997 radius 2.0repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then gosub @cleanup //-----1 actor.RemoveReferences([email protected]) jump @beginning end until 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stoppedgosub @cleanup //------2//basically, I don't want to write same code two times, that's why I'm using gosubactor.DestroyWithFade([email protected])jump @beginning0A93: end_custom_thread:cleanup0632: release_group [email protected]: disable_marker [email protected]: destroy_sphere [email protected] //"jump back" It's good idea to release models at the some point. Thanks, one more question ... If I want to add more stuff in this script, the best place to do it is between those lines? actor.Health([email protected]) = 400repeat and make it like that? (just example) actor.Health([email protected]) = 400:to_do_codewait 0 //rest of the code endrepeat Or did I have to delete this one "repeat"? (example) :to_do_code wait 0 //rest of the code end if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then actor.RemoveReferences([email protected]) jump @beginning end Link to comment Share on other sites More sharing options...
kosticn101 Posted August 2, 2017 Share Posted August 2, 2017 (edited) Depends on what you want to accomplish or to add.Don't let repeat confuse you. repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then actor.RemoveReferences([email protected]) jump @beginning enduntil 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0 Same as: :labelwait 0if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR definedthen actor.RemoveReferences([email protected]) jump @beginningendif 00EC: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 15.0 15.0else_jump @label You know what... Just decompile my script and you will see. If Sanny Builder asks you do you want original source code, say No.And if gosub confuses you, it's mostly used when you need to write some code multiple times, like I had to write some lines two times. So you create a new label at the end of a script and between that label and return you write some code. Then you can execute that code using gosub @label_name. Same as: repeat wait 0 if or actor.Dead([email protected]) 8256: not player $PLAYER_CHAR defined then 0632: release_group [email protected] 0164: disable_marker [email protected] 03BD: destroy_sphere [email protected] actor.RemoveReferences([email protected]) jump @beginning end until 00EF: actor $PLAYER_ACTOR sphere 0 near_point 206.9569 -1771.0079 radius 2.0 2.0 stopped0632: release_group [email protected]: disable_marker [email protected]: destroy_sphere [email protected]([email protected]) jump @beginning0A93: end_custom_thread Edited August 2, 2017 by kosticn101 szczypior 1 Link to comment Share on other sites More sharing options...
deltaCJ Posted August 3, 2017 Share Posted August 3, 2017 What he needs to make is a sniffer thread, where if the mission isn't done, and he's not on the mission, he can start the mission at the marker. He can make it replay many times. 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