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

LuckyMacky

Новичок
23
1
{$CLEO}

0000:
wait 300
repeat
wait 400
until 0AFA: is_samp_structures_available
0B34: samp register_client_command "txd" to_label @textdraw
whiletrue
wait0
end


:textdraw
for1@ = 0 to 2304
0AD0: show_formatted_text_lowpriority "~g~%d"1@ time 500
if
0C5D: samp textdraw 1@ is_exists
then
0af8:"texdraw ID %d" -1 1@
end
end
samp.cmdret


Что тут не так? ( Скрипт чтоб он вычислил id нажимающего textdraw )
 
Последнее редактирование:

BlackKnigga

Известный
BH Team
922
445
возник вопрос.. например у меня в зоне стрима 37 машин, я хочу получить кол-во хп этих машин и вывести рендер-опкодами в столбик. и чтобы этот столбик увеличивался или уменьшался в зависимости кол-ва машин, как я могу это сделать?
Например, записывать в какую нибудь переменную количество отрисованных строчек хп. И потом для каждой след. строчки вычислять Y координату используя эту переменную.

{$CLEO}

0000:
wait300
repeat
wait400
until 0AFA: is_samp_structures_available
0B34: samp register_client_command "txd" to_label @textdraw
whiletrue
wait0
end


:textdraw
for1@ = 0to2304
0AD0: show_formatted_text_lowpriority "~g~%d"1@ time 500
if
0C5D: samp textdraw 1@ is_exists
then
0af8:"texdraw ID %d" -11@
end
end
samp.cmdret


Что тут не так? ( Скрипт чтоб он вычислил id нажимающего textdraw )
Не стоит использовать циклы в теле команды.
 

LuckyMacky

Новичок
23
1
Кто поможет сделать скрипт который будет вычислять id textdraw, на который ты нажал? или будешь нажимать. Для серверов САМП.
 

serhiyrubin

Известный
396
104
Нужно например на фразу Дарова что то ответить
Вот нашел код, но вылетает после конекта к серверу
Подшаманьте плз чтобы пользоваться можно было)
Код:
{$CLEO}
{$INCLUDE SF}
0000: NOP

wait 2000

alloc 4@ 256
0c11: memset 4@ 0 256

0BE3: raknet setup_incoming_rpc_hook @ClientMessage

while true
wait 0
end

:ClientMessage
0BE5: raknet 0@ = get_hook_param PARAM_BITSTREAM
0BE5: raknet 1@ = get_hook_param PARAM_PACKETID
if
1@ == RPC_ScrClientMessage // DWORD color, DWORD strLen, char[] msg
then
    0BE7: raknet 2@ = bit_stream_read 0@ type BS_TYPE_INT  // color
    0BE7: raknet 3@ = bit_stream_read 0@ type BS_TYPE_INT  // strLen
    0C11: memset destination 4@ value 0 size 256
    0BE8: raknet bit_stream 0@ read_array 4@ size 3@ // Text
    0C0F: array 4@ element 3@ = 0x00

if
0C18: 7@ = strstr string1 4@ string2 "Дарова" //-Текст в чате
then
say "Соси до пол второго" //-Ответ
end
end

и

Код:
{$CLEO}
{$INCLUDE SF}
0000: NOP
0001: wait 2000 ms

:Noname_2
0001: wait 100 ms
0AC8: 2@ = allocate_memory_size 256
0B75: samp get_chat_string 99 text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
if
0C18: 7@ = strstr string1 2@ string2 "Дарова" //-Текст в чате
then
0001: wait 100 ms
0AF8: samp add_message_to_chat_with_color "%s" message 2@  
0AC9: free_allocated_memory 2@
end
0002: jump @Noname_2
 
Последнее редактирование:

BlackKnigga

Известный
BH Team
922
445
Кто поможет сделать скрипт который будет вычислять id textdraw, на который ты нажал? или будешь нажимать. Для серверов САМП.
Если текстдрав кликабельный, то можешь хукать ClickTextDraw. А на все остальные могу дать код C++ с SF API где вычисляется ид нажатого текстдрава, там может сам переведешь
 

romacaddy

Известный
Проверенный
234
206
Кто поможет сделать скрипт который будет вычислять id textdraw, на который ты нажал? или будешь нажимать. Для серверов САМП.
CLEO:
{$CLEO}
{$INCLUDE SF}

0BE1: raknet setup_outcoming_rpc_hook @ou_rpc
0B34: samp register_client_command "Text_Draw" to_label @cmd
0BDE: pause_thread 0

:ou_rpc
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
if and
    0@ == RPC_CLICKTEXTDRAW
    30@ == 1
then  
    alloc 3@ 256
    0BE5: raknet 1@ = get_hook_param PARAM_BITSTREAM
    0BE7: raknet 2@ = bit_stream_read 1@ type BS_TYPE_SHORT
    0C5A: samp textdraw 2@ get_string_to 3@
    0C59: samp textdraw 2@ get_model 10@ rotation 20@ 20@ 20@ zoom 20@ veh_color 20@ 20@
    0C57: samp textdraw 2@ get_shadow 20@ color 21@
    if
    10@ == 0
    then
        0AF8: samp add_message_to_chat "[TEXT_DRAW] - {ffffff}TXD ID - {00FFFF}%d {ffffff}| STRING - {00FFFF}%s " color 0x00FFFF params 2@ 3@
    else
        0AF8: samp add_message_to_chat "[TEXT_DRAW] - {ffffff}TXD ID - {00FFFF}%d {ffffff}| STRING - {00FFFF}%s {ffffff}| MODEL ID - {00FFFF}%d" color 0x00FFFF params 2@ 3@ 10@
    end
    free 3@
end
0BE0: raknet hook_ret true

:cmd
if 30@ == 1
then
30@ = 0
0AF8: samp add_message_to_chat "[TEXT_DRAW]-{ffFFFF} Disabled!" color 0x00FFFF
else
30@ = 1
0AF8: samp add_message_to_chat "[TEXT_DRAW]-{ffFFFF} Enabled!" color 0x00FFFF
end
samp.CmdRet()
 

hnnssy

Известный
Друг
2,684
2,748
Нужно например на фразу Дарова что то ответить
Вот нашел код, но вылетает после конекта к серверу
Подшаманьте плз чтобы пользоваться можно было)
Код:
{$CLEO}
{$INCLUDE SF}
0000: NOP

wait 2000

alloc 4@ 256
0c11: memset 4@ 0 256

0BE3: raknet setup_incoming_rpc_hook @ClientMessage

while true
wait 0
end

:ClientMessage
0BE5: raknet 0@ = get_hook_param PARAM_BITSTREAM
0BE5: raknet 1@ = get_hook_param PARAM_PACKETID
if
1@ == RPC_ScrClientMessage // DWORD color, DWORD strLen, char[] msg
then
    0BE7: raknet 2@ = bit_stream_read 0@ type BS_TYPE_INT  // color
    0BE7: raknet 3@ = bit_stream_read 0@ type BS_TYPE_INT  // strLen
    0C11: memset destination 4@ value 0 size 256
    0BE8: raknet bit_stream 0@ read_array 4@ size 3@ // Text
    0C0F: array 4@ element 3@ = 0x00

if
0C18: 7@ = strstr string1 4@ string2 "Дарова" //-Текст в чате
then
say "Соси до пол второго" //-Ответ
end
end

и
хук не закрыт у тебя
0BE0: raknet hook_ret 1
 

p1cador

cerf
Проверенный
220
359
0B75: samp get_chat_string 99 text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
С этим ничего не получится?
Ну бля показал же по человечески, через хуки....
Держи тогда говнокод, если так хочется
CLEO:
{$CLEO .cs}
0000:

while not SAMP.Available()
    wait 100
end

0AC6: 31@ = label @bMsg offset
0AC6: 30@ = label @bName offset

while true
    wait 0
    0B75: samp get_chat_string 99 text_to 31@ prefix_to 30@ color_to 4@ prefix_color_to 5@     
    if 0c89: 66
        then       
        0C18: 29@ = strstr string1 31@ string2 "здарова"       
        if 29@ <> 0
            then
            0af8: "TRUE" -1
            else
            0af8: "FALSE" -1
        end
    end
end


:bMsg
hex
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
end

:bName
hex
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
end
 
  • Нравится
Реакции: serhiyrubin