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

spiceman

GOWNIK <3
104
35
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
а где дамп данных? без них не надо
 

spiceman

GOWNIK <3
104
35
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.

Evgeniy13

Новичок
40
1
Как с помощью опкода 0AD3: 0@ = format написать в чат текст из массива? Например у меня есть такой массив:
0AC8: 0@ = allocate_memory_size 72
0C20: string_array 0@ element 0 size 12 = "YouTube"
0C20: string_array 0@ element 1 size 12 = "Sugar"
0C20: string_array 0@ element 3 size 12 = "Your"
0C20: string_array 0@ element 5 size 12 = "Door Lock"
Мне нужно, чтобы опкодом 0C18: 2@ = strstr string1 5@ string2 он нашел в строке чата заданное слово и выдал ответ из массива, но как это сделать? Если уточнить, мне нужно узнать как сделать так, чтобы вышеперечисленные опкоды брали текст именно из массива.
 

Evgeniy13

Новичок
40
1
Можете пожалуйста помочь в этом скрипте сделать включение по команде?
{$CLEO .cs}
{$INCLUDE SF}
0000:

repeat
wait 300
until 0AFA: is_samp_available

//0B34: samp register_client_command "test" to_label @TEST

while true
wait 1500

//:test
alloc 5@ 128
alloc 1@ 128
alloc 0@ 15


0B75: samp get_chat_string 99 text_to 5@ prefix_to 6@ color_to 7@ prefix_color_to 8@
/*0AF8: samp add_message_to_chat "Скопированна строка:" color 0xff0000
0AF8: samp add_message_to_chat 5@ color 0x0096fd */

0C28: strlwr in 5@ out 1@ //переводим нашу строку в нижний регистр

if 0C18: 2@ = strstr string1 1@ string2 "привет" //ищем подстроку в строке 1@

then
0AF8: samp add_message_to_chat "Условие выполнилось" color 0xff0000
//---Выделяем строку заключенную между [ ] из строки-----
0C2D: strrev in 5@ out 1@
0C16: 2@ = strtok string1 1@ string2 "["
0C2D: strrev in 2@ out 1@
0C16: 2@ = strtok string1 1@ string2 "]"
//---Выделяем строку заключенную между [ ] из строки-----

0AD3: 0@ = format "/b %s Ну qq" 2@

0AF9: samp say_msg 0@
end
free 1@
free 0@
free 5@
//0B43: samp cmd_ret
end
 

Woofing Giraffe

Активный
402
49
Можете пожалуйста помочь в этом скрипте сделать включение по команде?
{$CLEO .cs}
{$INCLUDE SF}
0000:

repeat
wait 300
until 0AFA: is_samp_available

//0B34: samp register_client_command "test" to_label @TEST

while true
wait 1500

//:test
alloc 5@ 128
alloc 1@ 128
alloc 0@ 15


0B75: samp get_chat_string 99 text_to 5@ prefix_to 6@ color_to 7@ prefix_color_to 8@
/*0AF8: samp add_message_to_chat "Скопированна строка:" color 0xff0000
0AF8: samp add_message_to_chat 5@ color 0x0096fd */

0C28: strlwr in 5@ out 1@ //переводим нашу строку в нижний регистр

if 0C18: 2@ = strstr string1 1@ string2 "привет" //ищем подстроку в строке 1@

then
0AF8: samp add_message_to_chat "Условие выполнилось" color 0xff0000
//---Выделяем строку заключенную между [ ] из строки-----
0C2D: strrev in 5@ out 1@
0C16: 2@ = strtok string1 1@ string2 "["
0C2D: strrev in 2@ out 1@
0C16: 2@ = strtok string1 1@ string2 "]"
//---Выделяем строку заключенную между [ ] из строки-----

0AD3: 0@ = format "/b %s Ну qq" 2@

0AF9: samp say_msg 0@
end
free 1@
free 0@
free 5@
//0B43: samp cmd_ret
end
Код:
{$CLEO .cs}

//-------------MAIN---------------
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end

while not SAMP.Available()
wait 100
end

alloc 1@ 128
alloc 2@ 64
alloc 3@ 128
alloc 4@ 64
0B34: samp register_client_command "test" to_label @3

while true
    wait 0
    0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 0 prefix_color_to 0 
    if 0C18: 3@ = strstr string1 1@ string2 "привет"
    then
        if 5@ == true
        then
            0AF8: samp add_message_to_chat "Условие выполнилось" color 0xff0000
            0C2D: strrev in 3@ out 1@
            0C16: 3@ = strtok string1 1@ string2 "["
            0C2D: strrev in 3@ out 1@
            0C16: 3@ = strtok string1 1@ string2 "]"
            0AD3: 4@ = format "/b %s Ну qq" 2@
            0AF9: samp say_msg 4@
        end
    end 
end

:3
if 5@ == false
then
    5@ = true
    0AF8: samp add_message_to_chat "Включено" color -1
else
    5@ = false
    0AF8: samp add_message_to_chat "Выключено" color -1
end
SAMP.CmdRet()
 

Vovich

HOT
Проверенный
717
197
во-первых, ты выбираешь не тот текстдрав. нужный тебе имеет id 0x08AD (2221)
во-вторых, текст содержит следующие символы - "Press ~g~~k~~CONVERSATION_YES~" (это Press Y) и "Press ~g~~k~~CONVERSATION_NO~" (Press N)
Что не так?
Код:
{$CLEO .cs}
0000:
 
0B34: samp register_client_command "cmd" to_label @cmd
alloc 1@ 128

while true
wait 0
if 0@ == true
then
if 0C5D: samp textdraw 2221 is_exists
then
0C5A: samp textdraw 2221 get_string_to 1@
if 0C14: strcmp string1 1@ string2 "Press Y"   
then   
wait 1000    
0B56: set_game_key 10 state 0x80
wait 100
0B56: set_game_key 10 state 0x0   
else
if 0C14: strcmp string1 1@ string2 "Press N"
then
wait 1000
0B56: set_game_key 11 state 0x80
wait 100
0B56: set_game_key 11 state 0x0
end
end
end
end
end

:cmd
if 0@ == false
then
0@ = true
else
0@ = false
end
SAMP.CmdRet()
 

spiceman

GOWNIK <3
104
35
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Что не так?
Код:
{$CLEO .cs}
0000:

0B34: samp register_client_command "cmd" to_label @cmd
alloc 1@ 128

while true
wait 0
if 0@ == true
then
if 0C5D: samp textdraw 2221 is_exists
then
0C5A: samp textdraw 2221 get_string_to 1@
if 0C14: strcmp string1 1@ string2 "Press Y"  
then  
wait 1000   
0B56: set_game_key 10 state 0x80
wait 100
0B56: set_game_key 10 state 0x0  
else
if 0C14: strcmp string1 1@ string2 "Press N"
then
wait 1000
0B56: set_game_key 11 state 0x80
wait 100
0B56: set_game_key 11 state 0x0
end
end
end
end
end

:cmd
if 0@ == false
then
0@ = true
else
0@ = false
end
SAMP.CmdRet()
я же написал какой текст тебе нужно использовать
 

Vovich

HOT
Проверенный
717
197
я же написал какой текст тебе нужно использовать
Код:
{$CLEO .cs}
0000:
 
0B34: samp register_client_command "ap" to_label @cmd
alloc 1@ 128

while true
wait 0
if 0@ == true
then
if 0C5D: samp textdraw 2221 is_exists
then
0C5A: samp textdraw 2221 get_string_to 1@
if 0C14: strcmp string1 1@ string2 "Press ~g~~k~~CONVERSATION_YES~"   
then   
wait 2000   
chatmsg "[Внимание]: Автонажатие работает. | Press Y" color 0xFF0000   
0B56: set_game_key 10 state 0x80
wait 100
0B56: set_game_key 10 state 0x0   
else
if 0C14: strcmp string1 1@ string2 "Press ~g~~k~~CONVERSATION_NO~"
then
wait 2000
chatmsg "[Внимание]: Автонажатие работает. | Press N" color 0xFF0000
0B56: set_game_key 11 state 0x80
wait 100
0B56: set_game_key 11 state 0x0
end
end
end
end
end

:cmd
if 0@ == false
then
print "~g~Actived" 1500
0@ = true
else
print "~r~Deactived" 1500
0@ = false
end
SAMP.CmdRet()
Но тогда нажимаются не нужные клавиши..
 

Evgeniy13

Новичок
40
1
Код:
{$CLEO .cs}

//-------------MAIN---------------
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end

while not SAMP.Available()
wait 100
end

alloc 1@ 128
alloc 2@ 64
alloc 3@ 128
alloc 4@ 64
0B34: samp register_client_command "test" to_label @3

while true
    wait 0
    0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 0 prefix_color_to 0
    if 0C18: 3@ = strstr string1 1@ string2 "привет"
    then
        if 5@ == true
        then
            0AF8: samp add_message_to_chat "Условие выполнилось" color 0xff0000
            0C2D: strrev in 3@ out 1@
            0C16: 3@ = strtok string1 1@ string2 "["
            0C2D: strrev in 3@ out 1@
            0C16: 3@ = strtok string1 1@ string2 "]"
            0AD3: 4@ = format "/b %s Ну qq" 2@
            0AF9: samp say_msg 4@
        end
    end
end

:3
if 5@ == false
then
    5@ = true
    0AF8: samp add_message_to_chat "Включено" color -1
else
    5@ = false
    0AF8: samp add_message_to_chat "Выключено" color -1
end
SAMP.CmdRet()
Cпасибо, команда действительно работает, но теперь скрипт не видит ID игрока. Т.е. раньше он отвечал /b id слово, а теперь /b "PpP p" слово"
 

Woofing Giraffe

Активный
402
49
Cпасибо, команда действительно работает, но теперь скрипт не видит ID игрока. Т.е. раньше он отвечал /b id слово, а теперь /b "PpP p" слово"
Если строка формата ник[ID]: привет, и ничего более, то этот код будет отлично работать:
Код:
{$CLEO .cs}

//-------------MAIN---------------
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end

while not SAMP.Available()
wait 100
end

alloc 1@ 128
alloc 2@ 64
alloc 3@ 64
4@v = 0
0B34: samp register_client_command "test" to_label @3

while true
    wait 0
    0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 0 prefix_color_to 0 
    if 5@ == true
    then
        0AA7: call 0x8220AD num_params 4 pop 4 params 4@v 5@ "%[\_a-zA-Z\[]%d]: Привет" 1@ read_params_to 6@
        if 6@ > 0
        then
            0AF8: samp add_message_to_chat "Условие выполнилось" color 0xff0000
            0AD3: 3@ = format "/b %d Ну qq" 4@
            0AF9: samp say_msg 3@
        end
    end
end

:3
if 5@ == false
then
    5@ = true
    0AF8: samp add_message_to_chat "Включено" color -1
else
    5@ = false
    0AF8: samp add_message_to_chat "Выключено" color -1
end
SAMP.CmdRet()
Если строка иная, скинь сюда, попробую помочь.