Jump to content

Add 0 in front of the money like GTA SA PC


Deff

Recommended Posts

is there something wrong with this script?
Quote

// This file was decompiled using SASCM.ini published by GTAG (http://gtagmodding.com/opcode-database/) on 7.7.2019
{$CLEO .csa}

//-------------MAIN---------------
thread 'DEFFMONEYGEDE'
wait 0 
0A5D: get_widget_position 37 10@ 11@ 12@ 13@ 
7@ = 158.5 
9@ = 0.0 
005B: 9@ += 10@ // (float) 
9@ -= 500.0 
9@ /= 3.0 
9@ *= 0.0 
005B: 7@ += 9@ // (float) 
005B: 10@ += 7@ // (float) 
11@ -= 18.0 


:money1
wait 0
30@ = 1
if
010A:   player $PLAYER_CHAR money > 30@ 
jf @money2
010B: 0@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF0' number 0@  // ~1~
jump @money1

:money2
wait 0
31@ = 9 
if
010A:   player $PLAYER_CHAR money > 31@
jf @money3
010B: 1@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF1' number 1@  // ~1~
jump @money2

:money3 
wait 0
32@ = 99
if
010A:   player $PLAYER_CHAR money > 32@ 
jf @money4
010B: 2@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF2' number 2@  // ~1~
jump @money3

:money4
wait 0
33@ = 999 
if 
010A:   player $PLAYER_CHAR money > 33@
jf @money5
010B: 3@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF3' number 3@  // ~1~
jump @money4

:money5 
wait 0
34@ = 9999
if
010A:   player $PLAYER_CHAR money > 34@
jf @money6
010B: 4@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF4' number 4@  // ~1~
jump @money5

:money6 
wait 0
35@ = 99999 
if
010A:   player $PLAYER_CHAR money > 35@
jf @money7
010B: 5@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF5' number 5@  // ~1~
jump @money6

:money7 
wait 0 
36@ = 999999
if
010A:   player $PLAYER_CHAR money > 36@
jf @money1
010B: 6@ = player $PLAYER_CHAR money
0349: set_text_draw_font 3
0343: set_text_draw_linewidth 700.0  
03E4: set_text_draw_align_right 1
033F: set_text_draw_letter_size 1.5 2.8 
0340: set_text_draw_RGBA 0 180 0 255 
081C: draw_text_outline 1 RGBA 0 0 0 255 
045A: draw_text_1number 10@ 11@ GXT 'DEFF6' number 6@  // ~1~
jump @money7

 

Edited by Deff
Link to comment
Share on other sites

The code stucks in the first check loop

The building of your checks for "if $PLAYER_CHAR money is bigger than" is not suitable,
because first check checks for the smallest value.
So this check will always be passed and repeats, but the other checks will never be read.


I simplified your codes to show what i mean:

:money1
if
010A:   player $PLAYER_CHAR money > 1 
jf @money2// leads to next check
010B: 0@ = player $PLAYER_CHAR money
jump @money1// let repeat this check

:money2
if
010A:   player $PLAYER_CHAR money > 99
jf @money3
010B: 1@ = player $PLAYER_CHAR money
jump @money2

 

You can fix the issue by invert the check order
First check the biggest value and as last the smallest

:money1
if
010A:   player $PLAYER_CHAR money > 999999 
jf @money2
010B: 0@ = player $PLAYER_CHAR money
jump @money1

:money2
if
010A:   player $PLAYER_CHAR money > 9
jf @money3
010B: 1@ = player $PLAYER_CHAR money
jump @money2

:money3 
if
010A:   player $PLAYER_CHAR money > 1 
jf @money4
010B: 2@ = player $PLAYER_CHAR money
jump @money3

 

 

And the last jump instruction at the end

jump @money7

 

let it lead back to beginning

jump @money1

 

 

Edited by ZAZ
Link to comment
Share on other sites

Stop using labels, jf etc. Sanny supports real condition blocks like

if
	0@ > 10
then
	...
else
	...
end

 

Instead of repeating similar code multiple times you can use loop:
 

010B: 0@ = player $PLAYER_CHAR money
while 0@ > 0
	...
	
	0@ /= 10
end

 

Edited by MiranDMC
Link to comment
Share on other sites

Each script has two timers TimerA and TimerB local variables. They automatically increase by elapsed milliseconds count.
To calculate time for example 5 seconds (5000 miliseconds) you need to compare one of the timers to that value.
To have timer percentage in range 0-100 you need to operation like 'percent = 100 * current / total', so after some mathematical simplification in script it will be something like:

5@ = TimerA / 50

for 5 seconds


You can do

TimerA = 0

to reset timer. Also you probably want to clamp result percentage to 100.

Edited by MiranDMC
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
  • 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.