Вопросы по CLEO-скриптингу

OnlyDeff

Новичок
10
0
Как в эдитбоксы(новые диалоги) вписать информацию с переменной ? И в диалоге добавить несколько строк ?
 

Dark_Knight

Me, me and me.
Друг
4,067
2,080
Код:
if 0aab: "cleo\ki\fonts.txt"
then
    2@ = file.Open("cleo\ki\fonts.txt", "rt")
    0ac8: 31@ = 256
    3@ = 11
    repeat
    wait 0
    0AD7: read_string_from_file 2@ to 31@ size 256
    dialog.ListBoxInsertElement(Font_Dialog, 1, 31@, 3@, -1)
    3@ ++ 
    until file.EOF(2@)
    0ac9: 31
    file.Close(2@)
end
Добавляет елемент в конец списка. Вместо строк можно переменные вставлять.
 

PopandaulX

Новичок
8
0
Hello. I need a little help to read the colors of a text.
0AF8: samp add_message_to_chat "{B2E4FF}Fail" color 0x19F577
If this text would be shown on chat, I want to read the B2E4FF, but using the getChatEntryColor function, it will return 10F577,
 

OnlyDeff

Новичок
10
0
Код:
if 0aab: "cleo\ki\fonts.txt"
then
    2@ = file.Open("cleo\ki\fonts.txt", "rt")
    0ac8: 31@ = 256
    3@ = 11
    repeat
    wait 0
    0AD7: read_string_from_file 2@ to 31@ size 256
    dialog.ListBoxInsertElement(Font_Dialog, 1, 31@, 3@, -1)
    3@ ++
    until file.EOF(2@)
    0ac9: 31
    file.Close(2@)
end
Добавляет елемент в конец списка. Вместо строк можно переменные вставлять.

Я именно хочу чтобы с этих переменных вставить например хп игрока, и чтобы изменения в хп отображались там, а не считывать информацию с txt
 

hnnssy

Известный
Друг
2,684
2,750
Hello. I need a little help to read the colors of a text.
0AF8: samp add_message_to_chat "{B2E4FF}Fail" color 0x19F577
If this text would be shown on chat, I want to read the B2E4FF, but using the getChatEntryColor function, it will return 10F577,
Use this:
Код:
0B75: samp get_chat_string 1@ text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
and then write a 2@ to the .txt file.
 

PopandaulX

Новичок
8
0
You must alocated the memory for all variables. 1@ - the number of chat_string. 99 - last chat message.
if
0AB0: key_pressed 75
then
0ac8: 3@ = 260
0B75: samp get_chat_string 99 text_to 3@ prefix_to 4@ color_to 5@ prefix_color_to 6@
0AF8: samp add_message_to_chat "%s" color 0xFFFFFF 3@
0ac9: 3@
end
This crashes.... if I replace 99 with 1@ it works, but returns weird characters
EDIT: oooh, all variables, wait
FINALLY! Thanks, now let me find that color code.
 

hnnssy

Известный
Друг
2,684
2,750
if
0AB0: key_pressed 75
then
0ac8: 3@ = 260
0B75: samp get_chat_string 99 text_to 3@ prefix_to 4@ color_to 5@ prefix_color_to 6@
0AF8: samp add_message_to_chat "%s" color 0xFFFFFF 3@
0ac9: 3@
end
This crashes.... if I replace 99 with 1@ it works, but returns weird characters
EDIT: oooh, all variables, wait
FINALLY! Thanks, now let me find that color code.
You must write the text to the .txt file if you wont get the color code.
 

san0

Известный
Друг
411
267
if
Thanks, now let me find that color code.
example for you - script get text and color of the line in hex and a r g b type
if you type command with /cinfo <params>, where params - 0 to 99
if you type without params - script chose 99 (last)
ps. sorry for English ;D
Код:
{$CLEO}
 
0662: "qwerty"
thread "compile"
 
repeat
    wait 40
until Samp.Available()
 
0B34: samp register_client_command "cinfo" to_label @cmd 
 
const
    line = 1@
    none = 0@
    cmd = 2@
    string = 3@
    pref = 5@
end
 
while true
    wait 0
end
 
:cmd
0B35: samp cmd = get_last_command_params
if 8AD4: cmd = scan_string cmd format "%d" line //IF and SET
then
    line = 99
end 
0AC8: string = free_allocated_memory 128 // max samp chat size 128
0AC8: pref = free_allocated_memory 64 // to prefix also
0B75: samp get_chat_string line text_to string prefix_to pref color_to 4@ prefix_color_to none
0B66: render argb 4@ to_a 6@ r 7@ g 8@ b 9@
0af8: "You sucessfully checked text and color to line %d" -1 line
0af8: "Text {00FF00}%s {FFFFFF}| color {00FFFF}%c%x%c{FFFFFF} and {FFFF00} %d %d %d %d {FFFFFF}in ARGB" -1 string 123 4@ 125 6@ 7@ 8@ 9@
0AC9: free_allocated_memory pref
0AC9: free_allocated_memory string 
Samp.CmdRet()
 

san0

Известный
Друг
411
267
Я именно хочу чтобы с этих переменных вставить например хп игрока, и чтобы изменения в хп отображались там, а не считывать информацию с txt
Вот тебе тоже пример - показывает твое изменение здоровья, сколько было и стало
Код:
{$CLEO}
 
0662: "This CLEO file"
thread "compile"
 
repeat
    wait 40
until Samp.Available()
 
Dialog.Create(29@, "Health Indicator") 
0B5A: get_screen_resolution 25@ 26@
26@ /= 2
0B84: dialog 29@ set_pos_XY 0 26@ size 300 300
Dialog.AddListBox(29@, 2, 0, 0, 300, 300)
Dialog.SetVisible(29@, true)
Dialog.ListBoxInsertElement(29@, 2, "Script Loaded", 0, -1)
alloc 4@ 128
 
const
    health = 0@ 
    health2 = 1@ 
end
 
while true
    wait 0
    health = Actor.Health($PLAYER_ACTOR)
    wait 1000
    health2 = Actor.Health($PLAYER_ACTOR)
    if 803B: health == health2  // (int)
    then
        if and
        Dialog.IsVisible(29@)   
        not Dialog.IsMinimized(29@)
        then
            format 4@ "{00FFFF}Было %d | {00FF00}стало %d" 0@ 1@    
            5@ ++   
            Dialog.ListBoxInsertElement(29@, 2, 4@, 5@, -1)
        end
    end
end
 

OnlyDeff

Новичок
10
0
Вот тебе тоже пример - показывает твое изменение здоровья, сколько было и стало
Код:
{$CLEO}
 
0662: "This CLEO file"
thread "compile"
 
repeat
    wait 40
until Samp.Available()
 
Dialog.Create(29@, "Health Indicator")
0B5A: get_screen_resolution 25@ 26@
26@ /= 2
0B84: dialog 29@ set_pos_XY 0 26@ size 300 300
Dialog.AddListBox(29@, 2, 0, 0, 300, 300)
Dialog.SetVisible(29@, true)
Dialog.ListBoxInsertElement(29@, 2, "Script Loaded", 0, -1)
alloc 4@ 128
 
const
    health = 0@
    health2 = 1@
end
 
while true
    wait 0
    health = Actor.Health($PLAYER_ACTOR)
    wait 1000
    health2 = Actor.Health($PLAYER_ACTOR)
    if 803B: health == health2  // (int)
    then
        if and
        Dialog.IsVisible(29@)
        not Dialog.IsMinimized(29@)
        then
            format 4@ "{00FFFF}Было %d | {00FF00}стало %d" 0@ 1@
            5@ ++
            Dialog.ListBoxInsertElement(29@, 2, 4@, 5@, -1)
        end
    end
end

Да-да, спасибо. "format 4@ "{00FFFF}Было %d | {00FF00}стало %d" 0@ 1@" мне надо было отформатировать строку, спасибо большое всем!

Вот так надо было мне


Код:
{$CLEO .cs}
 
0000: NOP
// SAMPFUNCS
if 8AF7: get_samp_base_to 33@
then 0A93: end_custom_thread
end
repeat
wait 400
until 0AFA: is_samp_structures_available
// ---------------------
 
while true
wait 0
if and
0ab0: 52
Player.Defined($PLAYER_ACTOR)
then
wait 1000
0@ = Actor.Health($PLAYER_ACTOR)
format 4@v "Actor Health: %d" 0@
0B80: samp 29@ = create_dialog "Info player"
0B84: samp dialog 29@ set_pos_XY 46 350 size 200 80
0B91: dialog 29@ add_static id 2 text 4@v pos_XY 6 13 size 150 15
0B86: samp dialog 29@ set_visible true
end
end

Еще вопрос, как сделать чтобы в этом скрипте строчки текста опкода 0b91 становились по очереди. И как сделать больше 16 символов в тексте ?