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

Dimk0

Новичок
10
1
  • Нравится
Реакции: AmoralFurry

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,462
Нашёл!
0D23: emulate key 14 state 0x0080 in gta
Нашел здесь http://www.blasthack.net/threads/cleo-plugin-mogaikafuncs.867/
Спасибо этому сайту :)
Это совсем не то...

Это в конец:
Код:
:keyPress
// 0@ - key, 1@ - time
// Example: 0AB1: call @keyPress 2 key 0@ time 1@
 
if 0AA2: 2@ = load_library "User32.dll"
then
    if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
    then
        0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
        wait 1@
        0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
    end
end
0AB2: ret 0

Это куда хочешь:
Код:
0AB1: call @keyPress 2 key 66 time 15
Зажимает клавишу B на 0,015 секунды.

Список десятичных кодов клавиш можешь узнать в справке SannyBuilder (F12 -> CLEO 3 Code Library -> Список значений кнопок для 0AB0).
Ну или в яндекс: Коды клавиш клавиатуры

Автор: MogAika.
Перевод в функцию: MelomanCool
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,462
Как узнать несколько параметров команды?
Форматированием.

Пример:
Код:
{$CLEO}
 
0000:
 
if
    8AF7: get_samp_base_to 33@
then
    0A93: end_custom_thread
end
repeat
wait 400
until 0AFA: is_samp_structures_available
 
wait 0
0B34: samp register_client_command "test" to_label @command
 
while true
    wait 0
end
 
:command
0B35: samp 0@ = get_last_command_params
if
    0AD3: string 0@ format "%d %d %d" 1@ 2@ 3@
then
    if and
        1@ > -1
        2@ > -1
        3@ > -1
    then
        0AF8: samp add_message_to_chat "1: %d" color 0xFF61BB 1@
        0AF8: samp add_message_to_chat "2: %d" color 0xFF61BB 2@
        0AF8: samp add_message_to_chat "3: %d" color 0xFF61BB 3@
    else
        0AF8: samp add_message_to_chat "Значения должны быть равны/больше нуля!" color 0xFF61BB
    end
end
SAMP.CmdRet
 

Thomas_Johnson

Известный
Проверенный
183
21
Форматированием.

Пример:
Код:
{$CLEO}
 
0000:
 
if
    8AF7: get_samp_base_to 33@
then
    0A93: end_custom_thread
end
repeat
wait 400
until 0AFA: is_samp_structures_available
 
wait 0
0B34: samp register_client_command "test" to_label @command
 
while true
    wait 0
end
 
:command
0B35: samp 0@ = get_last_command_params
if
    0AD3: string 0@ format "%d %d %d" 1@ 2@ 3@
then
    if and
        1@ > -1
        2@ > -1
        3@ > -1
    then
        0AF8: samp add_message_to_chat "1: %d" color 0xFF61BB 1@
        0AF8: samp add_message_to_chat "2: %d" color 0xFF61BB 2@
        0AF8: samp add_message_to_chat "3: %d" color 0xFF61BB 3@
    else
        0AF8: samp add_message_to_chat "Значения должны быть равны/больше нуля!" color 0xFF61BB
    end
end
SAMP.CmdRet
Не работает
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,462
Спутал с другим опкодом :D

Вот:
Код:
{$CLEO}
 
0000:
 
if
    8AF7: get_samp_base_to 33@
then
    0A93: end_custom_thread
end
repeat
wait 400
until 0AFA: is_samp_structures_available
 
wait 0
0B34: samp register_client_command "test" to_label @command
 
while true
    wait 0
end
 
:command
0B35: samp 0@ = get_last_command_params
if
    0AD4: 0@ = scan_string 0@ format "%d %d %d" 1@ 2@ 3@
then
    if and
        1@ > -1
        2@ > -1
        3@ > -1
    then
        0AF8: samp add_message_to_chat "1: %d" color 0xFF61BB 1@
        0AF8: samp add_message_to_chat "2: %d" color 0xFF61BB 2@
        0AF8: samp add_message_to_chat "3: %d" color 0xFF61BB 3@
    else
        0AF8: samp add_message_to_chat "Значения должны быть равны/больше нуля!" color 0xFF61BB
    end
end
SAMP.CmdRet
 
  • Нравится
Реакции: San6ka

Thomas_Johnson

Известный
Проверенный
183
21
Потерял статейку, в которой описано, как найти маркер, не поможете?
 

Z0DY

Новичок
24
0
how i can check the text of a string
Example 1@ = "Hello World"
now i dont want check if "hello" is in string 1@ if yes then say hi as Example
 

Dark_Knight

Me, me and me.
Друг
4,067
2,081
how i can check the text of a string
Example 1@ = "Hello World"
now i dont want check if "hello" is in string 1@ if yes then say hi as Example
Код:
{$CLEO}
0000:

while true
wait 0
if 0AB0: key_pressed 0x55 //U
then
0AC8: 0@ = allocate_memory_size 32
0AD3: string 0@ format "HOLY FUCKING SHIT. WORKING ^_^"
0AD1: show_formatted_text_highpriority "%s" time 2000 0@
while 0AB0: key_pressed 0x55
wait 0
end
0AC9: free_allocated_memory 0@
end
end
 

Z0DY

Новичок
24
0
Код:
{$CLEO}
0000:
 
while true
wait 0
if 0AB0: key_pressed 0x55 //U
then
0AC8: 0@ = allocate_memory_size 32
0AD3: string 0@ format "HOLY FUCKING SHIT. WORKING ^_^"
0AD1: show_formatted_text_highpriority "%s" time 2000 0@
while 0AB0: key_pressed 0x55
wait 0
end
0AC9: free_allocated_memory 0@
end
end
that not what i want :)
Код:
:start
wait 0
0AB1: call @getText 2 0@ 11@ return: 27@
if
string "Hello" is in 27@
then
    0AF9: samp say_msg "Hi"
end
jump @start
like this
 

D3LL

Новичок
1
0
Проблема с форматированием текста в SAMPFUNCS.
Например:
Код:
0B2B: samp 4@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B2A: samp 5@ = get_player_ping 4@
0AC8: 6@ = allocate_memory_size 128
0AD3: string 6@ format "ID: %d Ping: %d" 4@ 5@
В итоге, в чат выдает ID: D PING: D
При декомпилировании скрипта, вместо этого:
Код:
 0AD3: string 6@ format "ID: %d Ping: %d" 4@ 5@
Или этого:
Код:
0AF9: samp say_msg "ID: %d Ping: %d" 4@ 5@
Получается это:
Код:
0AD3: string 6@ "ID: %D PING: %D" 4@ 5@
И, соответственно это:
Код:
0AF9: samp say_msg "ID: %D PING: %D" 4@ 5@
В чем проблема?