Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

labels question


szczypior
 Share

Recommended Posts

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 by szczypior
Link to comment
Share on other sites

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 by kosticn101
Link to comment
Share on other sites

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 by kosticn101
Link to comment
Share on other sites

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 by szczypior
Link to comment
Share on other sites

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 by kosticn101
Link to comment
Share on other sites

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 by madleg
Link to comment
Share on other sites

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 by szczypior
Link to comment
Share on other sites

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

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

 

 

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. :D
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 by kosticn101
Link to comment
Share on other sites

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 by szczypior
Link to comment
Share on other sites

 

 

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. :D

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

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 by kosticn101
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.