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!

[SA] Input numbers Error


Marty McFlaY
 Share

Recommended Posts

Marty McFlaY

Here is the code:

 

:cheat
wait 0
if
  0ADC: "test"
jf @cheat
06D2: [email protected] = "" // @v = string
06D2: [email protected] = "" // @v = string
0AD1: "Enter any number" 10000 
jump @0

:0
wait 0
if
  0AB0: 48
jf @1
wait 500
06D2: [email protected] = "0" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @0

:1
wait 0
if
  0AB0: 49
jf @2
wait 500
06D2: [email protected] = "1" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @1

:2
wait 0
if
  0AB0: 50
jf @3
wait 500
06D2: [email protected] = "2" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @2

:3
wait 0
if
  0AB0: 51
jf @4
wait 500
06D2: [email protected] = "3" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @3

:4
wait 0
if
  0AB0: 52
jf @5
wait 500
06D2: [email protected] = "4" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @4

:5
wait 0
if
  0AB0: 53
jf @6
wait 500
06D2: [email protected] = "5" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @5

:6
wait 0
if
  0AB0: 54
jf @7
wait 500
06D2: [email protected] = "6" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @6

:7
wait 0
if
  0AB0: 55
jf @8
wait 500
06D2: [email protected] = "7" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @7

:8
wait 0
if
  0AB0: 56
jf @9
wait 500
06D2: [email protected] = "8" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @8

:9
wait 0
if
  0AB0: 57
jf @0
wait 500
06D2: [email protected] = "9" // @v = string
098C: [email protected] = [email protected] + [email protected] // all string variables
0AD1: "%s" 3000 [email protected]
jump @9

The problem is when I type any five numbers, the script automatically add two more same. I don't want to add two more same numbers so please inspect it and see what is the problem here as I cannot figure it out:

 

Here, take a look at it:

6ZFfLuH.png

 

Also,

 

If anyone knows how to remove the last string like if there is any method to do so?

Link to comment
Share on other sites

Marty McFlaY
3 hours ago, OrionSR said:

It looks like your variables are getting mixed together. [email protected] starts 4 bytes after [email protected] Change all references of [email protected] [email protected] and you should be safe with this size of variable length string.

Thank you, it is working. 

 

Also, how to remove the last character of string? Is there any method to do so?

Link to comment
Share on other sites

Um... not sure. Maybe something like...

0ADF: add_text_label "_TEST" text [email protected]
09FD: get_string_width '_TEST' store_to [email protected]
0AE0: remove_text_label "_TEST"
0AC7: get_var_pointer [email protected] store_to [email protected]
005A: [email protected] += [email protected]  //variable address + character offset
000C: [email protected] -= 1   // number of characters to delete
0A8C: write_memory [email protected] size 1 val 0 vp 0

Note: These codes are using an SCR style opcode format. You may need to convert them to the Sanny parameter order.

Edited by OrionSR
Link to comment
Share on other sites

Marty McFlaY
28 minutes ago, OrionSR said:

Um... not sure. Maybe something like...

0ADF: add_text_label "_TEST" text [email protected]
09FD: get_string_width '_TEST' store_to [email protected]
0AE0: remove_text_label "_TEST"
0AC7: get_var_pointer [email protected] store_to [email protected]
005A: [email protected] += [email protected]  //variable address + character offset
000C: [email protected] -= 1   // number of characters to delete
0A8C: write_memory [email protected] size 1 val 0 vp 0

Note: These codes are using an SCR style opcode format. You may need to convert them to the Sanny parameter order.

It is crashing, don't know why

 

Also, try to attach it with my full code so I can understand it more easily. I am waiting for your reply 😊

Link to comment
Share on other sites

This snippet might be more compatible with your current script.  Otherwise, I don't know why it would crash, and I'm not sure if it will work either. This isn't the question I was intending to answer.

0ADF: add_text_label "_TEST" text [email protected]
09FD: get_string_width '_TEST' store_to [email protected]
0AE0: remove_text_label "_TEST"
//0AC7: get_var_pointer [email protected] store_to [email protected]
0AC7: [email protected] = var [email protected] offset
005A: [email protected] += [email protected]  // variable address + character offset 
000C: [email protected] -= 1   // number of characters to delete
0A8C: write_memory [email protected] size 1 val 0 vp 0

And the lack of command names makes your code difficult to read. I'll leave the script integration to you as I don't want to figure out what you've done.

 

Added: It would be a good idea to verify that the number of characters to delete is not greater than the string length.

Edited by OrionSR
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.