CLEO Help commas number

CLEO related
Status
Not open for further replies.

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
maybe this is not the best way to do it but it should work

Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available
 

while true
wait 0
alloc 0@ 256

0C11: memset destination 0@ value 0 size 256
format 0@ "123"
call @numberwithcommas 1 0@
chatmsg "%s" -1 0@

0C11: memset destination 0@ value 0 size 256
format 0@ "93492"
call @numberwithcommas 1 0@
chatmsg "%s" -1 0@

0C11: memset destination 0@ value 0 size 256
format 0@ "4738284874"
call @numberwithcommas 1 0@
chatmsg "%s" -1 0@

0C11: memset destination 0@ value 0 size 256
format 0@ "488248"
call @numberwithcommas 1 0@
chatmsg "%s" -1 0@

0C11: memset destination 0@ value 0 size 256
format 0@ "2482"
call @numberwithcommas 1 0@
chatmsg "%s" -1 0@

free 0@
end

:numberwithcommas
0C17: 1@ = strlen 0@
0B14: 8@ = 1@ MOD 3
if
8@ == 0
then
8@ = 1
end
    if
    1@ > 3
    then
    0085: 2@ = 0@
    005A: 2@ += 1@
    0085: 3@ = 1@
    2@--
    0062: 3@ -= 8@
    3@ /= 3
    005A: 1@ += 3@
        if
        3@ > -1
        then
            for 4@ = 1 to 3@
            2@ -= 3
            0085: 6@ = 2@
            6@ += 1
            0C10: memcpy destination 6@ source 2@ size 1@
            0C0D: struct 2@ offset 1 size 1 = 44
            end
        end
    end
0AB2: 0
 

Strechea

Active member
Joined
Jan 26, 2017
Messages
28
Reaction score
2
Haha, mine looks more terible, but at least it works

Code:
:mefunc
10@ will be the number we want to add commas 
alloc 10@ = 260
format 10@ = "696969969"
0AC8: 0@ = allocate_memory_size 260
0AC8: 24@ = allocate_memory_size 260
0AD3: 0@ = format "%d" 10@
free 10@
0AD3: 24@ = format " "
0C17: 31@ = strlen 0@
31@ -= 1
0085: 28@ = 0@
005A: 28@ += 31@
0085: 27@ = 0@
for 30@ = 0@ to 28@
0A8D: 29@ = read_memory 30@ size 1 virtual_protect 1
    if and 
        0029:   29@ >= 48
        002B:   57 >= 29@
    then
        0A8C: write_memory 24@ size 1 value 29@ virtual_protect 1
        0C1A: 17@ = atoi 24@
        0AB1: @SET 3 passed_value 17@ var_number 8@ var_size 4
        8@++
    end     
end

0AC8: 16@ = allocate_memory_size 260
0AD3: 16@ = format "$"
call @funct 2 8@ 3 RetTo 25@   

8@--
for 19@ = 0 to 8@
    0AB1: @GET 2 var_number 19@ var_size 4 receiver 13@
    
    call @funct 2 19@ 3 RetTo 17@ 
    if and
        003B:   17@ == 25@  // (int)
        19@ <> 0
    then 0AD3: 16@ = format "%s," 16@
    end
    0AD3: 16@ = format "%s%d" 16@ 13@
end    

chatmsg "Number: %s" -1 16@
Free 16@

8@ = 0
Free 0@
Free 24@
Free 7@
return

:funct
while 0@ >= 0
    0062: 0@ -= 1@  // (int)
end
005A: 0@ += 1@  // (int)
ret 1 0@

:SET  
0AC6: 3@ = get_label_pointer @MEMORY
int 1@ *= 4  
int 3@ += 1@
0A8C: write_memory 3@ size 2@ value 0@ virtual_protect 0
ret 0

:GET
0AC6: 3@ = get_label_pointer @MEMORY
int 0@ *= 4
int 3@ += 0@
0A8D: 2@ = read_memory 3@ size 1@ virtual_protect 0
ret 1 2@

:MEMORY
hex
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
end
 

JaggerJam

Active member
Joined
Sep 14, 2017
Messages
97
Reaction score
21
What the fuck, this doesn't work?
format 0@ "\"%d\" "
Try it.
Haha, mine looks more terible, but at least it works

Code:
:mefunc
10@ will be the number we want to add commas 
alloc 10@ = 260
format 10@ = "696969969"
0AC8: 0@ = allocate_memory_size 260
0AC8: 24@ = allocate_memory_size 260
0AD3: 0@ = format "%d" 10@
free 10@
0AD3: 24@ = format " "
0C17: 31@ = strlen 0@
31@ -= 1
0085: 28@ = 0@
005A: 28@ += 31@
0085: 27@ = 0@
for 30@ = 0@ to 28@
0A8D: 29@ = read_memory 30@ size 1 virtual_protect 1
    if and 
        0029:   29@ >= 48
        002B:   57 >= 29@
    then
        0A8C: write_memory 24@ size 1 value 29@ virtual_protect 1
        0C1A: 17@ = atoi 24@
        0AB1: @SET 3 passed_value 17@ var_number 8@ var_size 4
        8@++
    end     
end

0AC8: 16@ = allocate_memory_size 260
0AD3: 16@ = format "$"
call @funct 2 8@ 3 RetTo 25@   

8@--
for 19@ = 0 to 8@
    0AB1: @GET 2 var_number 19@ var_size 4 receiver 13@
    
    call @funct 2 19@ 3 RetTo 17@ 
    if and
        003B:   17@ == 25@  // (int)
        19@ <> 0
    then 0AD3: 16@ = format "%s," 16@
    end
    0AD3: 16@ = format "%s%d" 16@ 13@
end    

chatmsg "Number: %s" -1 16@
Free 16@

8@ = 0
Free 0@
Free 24@
Free 7@
return

:funct
while 0@ >= 0
    0062: 0@ -= 1@  // (int)
end
005A: 0@ += 1@  // (int)
ret 1 0@

:SET  
0AC6: 3@ = get_label_pointer @MEMORY
int 1@ *= 4  
int 3@ += 1@
0A8C: write_memory 3@ size 2@ value 0@ virtual_protect 0
ret 0

:GET
0AC6: 3@ = get_label_pointer @MEMORY
int 0@ *= 4
int 3@ += 0@
0A8D: 2@ = read_memory 3@ size 1@ virtual_protect 0
ret 1 2@

:MEMORY
hex
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
end
 
Status
Not open for further replies.
Top