crashoverride93 Posted January 10, 2016 Share Posted January 10, 2016 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 More sharing options...
Jack Posted January 10, 2016 Share Posted January 10, 2016 8183: not player $PLAYER_CHAR health > 100This 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/ Wanted Level Editor End Phone Call in Vice City My YouTube Channel Link to comment Share on other sites More sharing options...
crashoverride93 Posted January 11, 2016 Author Share Posted January 11, 2016 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 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