D J C 181 Posted March 18 Problem description: Can you give explanations of const function and where can be used for ?! Code (the source on which to help you, if necessary): const _WHITE = 0xFFFFFF _RED = 0xFF0000 _BLUE = 0x0000FF end Other remarks: My issue: chatmsg "{%x}Test red color, {%x}Test blue color, {%x}Test white color." -1 _RED _BLUE _WHITE Output: Test red color, [0000FF]Test blue color, Test white color. 1 Share this post Link to post Share on other sites
Tupi 479 Posted March 19 (edited) Hi, const can be use for define some variables, like integers, floats or colors which always have the same value const max_numbers = 10 max_distance = 25.0 COLOR_RED = 0xFF0000 end if 0@ == max_numbers then some code ... end if 0@ == max_distance then some code ... end chatmsg "{%x}This is a message" -1 COLOR_RED Unfortunately it cannot be used for the string, because it does not allow the use of space to separate two or more words, but only one single word with a small number of characters. cont specific_word = "house" end if 0C29: 33@ = stristr string1 0@ string2 specific_word then some code ... end Edited March 19 by Tupi 0 Share this post Link to post Share on other sites
D J C 181 Posted March 19 {$CLEO} {$CLEO .cs} //----MAIN---- 03A4: name_thread "test" 0001: wait 609 ms 0B34: samp register_client_command "test" to_label @test const _WHITE = 0xFFFFFF _RED = 0xFF0000 _BLUE = 0x0000FF end :looper 0001: wait 0 ms 0002: jump @looper :test chatmsg "{%x}Test red color, {%x}Test blue color, {%x}Test white color." -1 _RED _BLUE _WHITE 0B43: samp cmd_ret Output: 0 Share this post Link to post Share on other sites
Tupi 479 Posted March 19 Try to use a different hex code for blue color. 0 Share this post Link to post Share on other sites
D J C 181 Posted March 20 I realized that when the hex color code starts from 0x0_ _ _ _ _, unfortunately, the bug I put in the previous comment will be created. const _BLUE = 0x0000FF end chatmsg "{%x}Test blue color" -1 _BLUE The output will be like this > {FF}Test blue color kinda buggy Code: {$CLEO} {$CLEO .cs} //----MAIN---- 03A4: name_thread "test" 0001: wait 609 ms 0B34: samp register_client_command "test" to_label @test const _WHITE = 0xFFFFFF _RED = 0xFF0000 _YELLOW = 0xFFFF1A _BLACK = 0x141414 _BLUE = 0x8C1AFF _ORANGE = 0xFF8C1A _SFSI = 0x11FF82 _PD = 0x1E519D _NEWS = 0xC2A2DA end :looper 0001: wait 0 ms 0002: jump @looper :test chatmsg "{%x}Test red color, {%x}Test blue color, {%x}Test white color." -1 _RED _YELLOW _WHITE chatmsg "{%x}Test BLACK color, {%x}Test BLUE color, {%x}Test ORANGE color." -1 _BLACK _BLUE _ORANGE chatmsg "{%x}Test SI color, {%x}Test PD color, {%x}Test NEWS color." -1 _SFSI _PD _NEWS 0B43: samp cmd_ret Output: Anyway thanks, the main problem solved. 0 Share this post Link to post Share on other sites