Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Writing variable value in a txt file


Ify24
 Share

Recommended Posts

Okay I figured it out but now I have a problem, here is the code:

{$CLEO .cs}thread "DRU"0A95: enable_thread_saving0A9A: $hFILE = openfile "CLEO\VARR.ini" mode "rt+" 0AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int":Check_1wait 0 ms077E: get_active_interior_to $ACTIVE_INTERIORif$ACTIVE_INTERIOR == 0jf @Check_1Model.Load(#WMYDRUG)038B: load_requested_models:Check_2wait 0 msifModel.Available(#WMYDRUG)jf @Check_2Actor.Create($DEALER, Dealer, #WMYDRUG, -490.372, 1504.965, 8.688)Actor.Angle($DEALER) = 121.0:Check_3wait 0 msif00F3:   actor $PLAYER_ACTOR near_actor $DEALER radius 1.8 1.8 sphere 0 on_footjf @Check_6jump @NEAR_Truee:Check_6wait 0 msif0AB0:   key_pressed 0x49jf @Check_30ACE: show_formatted_text_box "You have %d g." [email protected] @Check_3:NEAR_TrueePlayer.CanMove($PLAYER_CHAR, False)0ACE: show_formatted_text_box "Would you like to buy some weed ? (Y or N?)" 0x0ACE:Check_4wait 0 msif0AB0:   key_pressed 0x59jf @Check_5jump @BUY:Check_5wait 0 msif0AB0:   key_pressed 0x4Ejf @Check_40ACE: show_formatted_text_box "Come back any time if you change your mind." 0x0ACEPlayer.CanMove($PLAYER_CHAR, True)wait 3500 msjump @Check_3:BUYPlayer.CanMove($PLAYER_CHAR, True)0ACE: show_formatted_text_box "This is %.4X opcode" 0x0ACEwait 3500 [email protected] += 10AF1: write_int [email protected] to_ini_file "CLEO\VARR.ini" section "Varr" key "int"jump @Check_3

So everything worked pretty well until I saved my game.

Code changed int value in file and read it and gave outpout ingame everything great.

Then when I try to load my game it would crash, SA Limit Adjuster: GTA:SA Crashed, Last File Loaded:DRU.cs bla bla (Also I have GTA United 1.1 instaled but I think that doesn't have anything much to do with crashes)

 

So can somebody help me?

 

EDIT: Also, when I start a new game the script works pretty good, but then again if I save the game and then load it it crashes :/

Edited by Ify24
Link to comment
Share on other sites

Oh I figured it out I don't need 0a95 opcode becouse I don't need to save variable value

becouse it reads it from a file but I thought that idk, nevermind xD

Link to comment
Share on other sites

Now I have a problem, I don't need to save my game but game will know how much g's but now

I can buy weed, not save my game, then load a game again, my money will return and the weed will stay,

can someone help me with this ?

Link to comment
Share on other sites

Sorry guys for5 posts in a row, but It doesn't work, I don't know what the f is going on, here is the script:

{$CLEO .cs}thread "DRU":Check_1wait 0 ms077E: get_active_interior_to $ACTIVE_INTERIORif$ACTIVE_INTERIOR == 0thenjump @STARTelsejump @Check_0end:Check_0wait 0 msif0AB0: key_pressed 0x49then0A9A: $hFILE = openfile "CLEO\VARR.ini" mode "rt+"0AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int"0ACE: show_formatted_text_box "You have %d g." [email protected]: closefile $hFILEwait 1000 msendjump @Check_1:STARTModel.Load(#WMYDRUG)038B: load_requested_models:Check_2wait 0 msifModel.Available(#WMYDRUG)jf @Check_2Actor.Create($DEALER, Dealer, #WMYDRUG, -490.372, 1504.965, 8.688)Actor.Angle($DEALER) = 121.0:Check_3wait 0 msif00F3: actor $PLAYER_ACTOR near_actor $DEALER radius 1.8 1.8 sphere 0 on_footjf @Check_6jump @NEAR_Truee:Check_6wait 0 msif0AB0: key_pressed 0x49jf @Check_30A9A: $hFILE = openfile "CLEO\VARR.ini" mode "rt+"0AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int"0ACE: show_formatted_text_box "You have %d g." [email protected]: closefile $hFILEwait 1000 msjump @Check_3:NEAR_TrueePlayer.CanMove($PLAYER_CHAR, False)0ACE: show_formatted_text_box "Would you like to buy some weed, 20$ for a G?(Y or N?)" 0x0ACE:Check_4wait 0 msif0AB0: key_pressed 0x59jf @Check_5jump @BUY:Check_5wait 0 msif0AB0: key_pressed 0x4Ejf @Check_40ACE: show_formatted_text_box "Come back any time if you need the stuff." 0x0ACEPlayer.CanMove($PLAYER_CHAR, True)wait 3500 msjump @Check_3:BUY0ACE: show_formatted_text_box "Would you like some more (Y or N)?" 0x0ACE0109: player $PLAYER_CHAR money += -200A9A: $hFILE = openfile "CLEO\VARR.ini" mode "rt+"[email protected] += 10AF1: write_int [email protected] to_ini_file "CLEO\VARR.ini" section "Varr" key "int"0A9B: closefile $hFILEwait 500 msjump @Check_4 

Everything works great but as I said when I save a game after buying some "weed" and then I try to load it game chrashes after loading screen

 

EDIT: Okay I now really figured it out, this script works very good on unmodded GTA:SA (With changed actor coords ofc) I can save my game after playing with script and then load it, tried it a few times all good, no problem.

But, for some reason it doesn't work well with GTA United 1.1, well it works but as I said a few times now, it chrashes when I play a game with a script, then save, and then load, the crash happens right after load screen appears and SA Limit Adjuster says that the problem is DRU.cs, but to unmodded GTA:SA, it really isn't, why is that so, I don't know. Hmmmm....

Edited by Ify24
Link to comment
Share on other sites

uhm :/ test this;

{$CLEO}thread "DRU":begin_coderepeat wait 0until  0AB0: key_pressed 0x49while true077E: get_active_interior_to $ACTIVE_INTERIORif  $ACTIVE_INTERIOR == 0then    break   // goto @STARTendif  0AB0: key_pressed 0x49then    0AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int"    0ACE: show_formatted_text_box "You have %d g." [email protected]    wait 1000end wait 0end:STARTModel.Load(#WMYDRUG)038B: load_requested_modelsrepeat wait 0until Model.Available(#WMYDRUG)Actor.Create($DEALER, Dealer, #WMYDRUG, -490.372, 1504.965, 8.688)Actor.Angle($DEALER) = 121.0:check_in_spherewhile trueif00F3: actor $PLAYER_ACTOR near_actor $DEALER radius 1.8 1.8 sphere 0 on_footthen    break  // jump @NEAR_Trueeendif0AB0: key_pressed 0x49then    0AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int"    0ACE: show_formatted_text_box "You have %d g." [email protected]    wait 1000end wait 0end:NEAR_TrueePlayer.CanMove($PLAYER_CHAR, False)0ACE: show_formatted_text_box "Would you like to buy some weed, 20$ for a G?(Y or N?)"while trueif0AB0: key_pressed 0x59then     break // jump @BUYendif0AB0: key_pressed 0x4Ethen    0ACE: show_formatted_text_box "Come back any time if you need the stuff."    Player.CanMove($PLAYER_CHAR, True)    wait 3500    goto @check_in_sphereend wait 0end:BUY0109: player $PLAYER_CHAR money += -200AF0: [email protected] = get_int_from_ini_file "CLEO\VARR.ini" section "Varr" key "int"     /// get value0AB1: call_scm_func @IncreaseValue 1 actual_valuei [email protected] updated_valuei [email protected]: write_int [email protected] to_ini_file "CLEO\VARR.ini" section "Varr" key "int"      ///  update valuewhile true0ACE: show_formatted_text_box "Would you like some more (Y or N)?"if  00E1:   player 0 pressed_key 11 // conversation - yesthen    goto @NEAR_Trueeendif  00E1:   player 0 pressed_key 10 // conversation - nothen    0ACE: show_formatted_text_box "Come back any time if you need the stuff."    Player.CanMove($PLAYER_CHAR, True)    wait 1500    breakend wait 0endgoto @check_in_sphere:[email protected]: [email protected]: [email protected] = [email protected]@ += 1  // Increase value0AB2: ret 1 [email protected]/*functions included;0AB1: call_scm_func @IncreaseValue 1 actual_valuei [email protected] updated_value [email protected]: call_scm_func @DecreaseValue 1 actual_valuei [email protected] updated_value [email protected]:[email protected]: [email protected]: [email protected] = [email protected]@ += 1  // Increase value0AB2: ret 1 [email protected]:[email protected]: [email protected]: [email protected] = [email protected]@ += -1  // Decrease value0AB2: ret 1 [email protected]*/

should work

 

 

Not tested.

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.