Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Contract
      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

coding a small mod in vice city


crashoverride93
 Share

Recommended Posts

crashoverride93

My code is below this is a simple idea so I figure it should be possible but any way what I am trying to do is create a small Cleo script in GTA vice city that checks to see if your player health is at 100 and if it is then pay in spray is free if not then no and It doesn't seem to be checking my health can someone please give me some in site I was thinking this should be simple but the problem is that the health ain't being checked and its jumping to always free please help somebody thanks in advanced

 

 

 

 

{Cleo.cs}

 

//-------------MAIN---------------

thread 'HNS'

 

:HNS_1

wait 100

if

Player.Defined($PLAYER_CHAR)

else_jump @HNS_1

if

8183: not player $PLAYER_CHAR health > 100

Jump @HNS_3

else_jump @HNS_2

 

:HNS_2

0335: set_free_paynspray_to 0

wait 0

Jump at @HNS_1

 

:HNS_3

0335: set_free_paynspray_to 1

wait 0

Jump at @HNS_1

Link to comment
Share on other sites

 

8183: not player $PLAYER_CHAR health > 100
This just checks if a player health is bellow 100 - not exactly 100.
You either do this:

IF AND    0183: player $PLAYER_CHAR health > 99 // health > 99    8183:   NOT   player $PLAYER_CHAR health > 101  // helth < 101    THEN    // health now must be 100 [99 < health < 101]    0335: set_free_paynspray_to 1    END

or this (better way):
0225: [email protected] = player $PLAYER_CHAR health // players health is now stored inside the [email protected] variable    IF          0039:   [email protected] == 100 // checking if player health ([email protected]) is equal (==) to value 100    THEN    0335: set_free_paynspray_to 1    END

So lets put this stuff in a loop:
WHILE TRUE    wait 0    0225: [email protected] = player $PLAYER_CHAR health // players health is now stored inside the [email protected] variable    IF          0039:   [email protected] == 100 // checking if player health ([email protected] == 100) is equal to 100    THEN    // player's health ([email protected]) is equal to 100    0335: set_free_paynspray_to 1    ELSE    // player's health ([email protected]) is NOT equal to 100    0335: set_free_paynspray_to 0    ENDEND

To make the code even more perfect we must do some memory checking:

{$CLEO}0000: CHREPEAT    wait 250UNTIL 0256: player $PLAYER_CHAR definedWHILE TRUE    wait 0    0225: [email protected] = player $PLAYER_CHAR health    IF        0039:   [email protected] == 100 // integer values    THEN    // player's health ([email protected]) is equal to 100    0006: [email protected] = 0 // notice here that is used the sign "=" instead of "=="    05E0: [email protected] = read_memory 0xA10AB5 size 1 virtual_protect 0 // this reads the 0335 opcode status of pay&spray garage        IF            0039:   [email protected] == 0 // integer values        THEN        // pay&spray == 0        05DF: write_memory 0xA10AB5 size 1 value 1 virtual_protect 0 // does the same as 0335: set_free_paynspray_to 1        END    ELSE    // player's health ([email protected]) is NOT equal to 100    0006: [email protected] = 0 // integer values    05E0: [email protected] = read_memory 0xA10AB5 size 1 virtual_protect 0        IF            0039:   [email protected] == 1 // integer values        THEN        05DF: write_memory 0xA10AB5 size 1 value 0 virtual_protect 0        END    ENDEND

Also I use high level code because it's much quicker and easier to make codes (even if the codes are way more complex).
You can check how these codes look like in the low level coding (like your code) - just compile then decompile. But I wouldn't recomend it.

 

And next time start coding topics in the appropriate section of a forum - http://gtaforums.com/forum/317-coding/

Link to comment
Share on other sites

crashoverride93

Well thank you I didn't know anything about hi level code I was following decompiled code and trying to piece it together in my mind and understand how it works

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.