[SNIPPET] ReadStringFromList

Lets you read a string from a list by id. Useful for advanced shit.


Code:
0AB1: @ReadStrFromList 2 at @STRINGS with_id 3 save_into 0@
:ReadStrFromList
0AC6: 0@ = label 0@ offset 
000A: 0@ += 0x4    
0006: 2@ = 0 
WHILE 001D:   1@ > 2@ 
    0006: 3@ = 1 
    WHILE 3@ <> 0   
        0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0
        0@++
    END
    000A: 0@ += 0x3
    2@++
END
0AB2: 1 0@
:STRINGS 
0900: "This string has id 0"
0900: "This one has id 1"
0900: "And this one 2"
0900: "and so on.. 3"
0000:


Example source code:

Code:
{$CLEO .cs}
0000:

REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

FOR 31@ = 0 TO 5
    // 0@ = you dont need to allocate memory to store the string.
    0AB1: @ReadStrFromList 2 at @WELCOME_MESSAGES with_id 31@ save_into 0@
    0AF8: add_samp_chat_message "%s" -1 0@
END


WHILE TRUE
    WAIT 0
END



0AB1: @ReadStrFromList 2 at @STRINGS with_id 3 save_into 0@
:ReadStrFromList
0AC6: 0@ = label 0@ offset 
000A: 0@ += 0x4    
0006: 2@ = 0 
WHILE 001D:   1@ > 2@ 
    0006: 3@ = 1 
    WHILE 3@ <> 0   
        0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0
        0@++
    END
    000A: 0@ += 0x3
    2@++
END
0AB2: 1 0@


:WELCOME_MESSAGES 
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string ZERO!"
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string ONE!"
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string TWO!"
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string THREE!"
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string FOUR!"
0900: "{FF0000}TEST:{FFFFFF} Hey, this is string FIVE!"
0000:

It's from FYP.
 
Top