- 2,684
- 2,762
Описание: кликабельный биндер команд. Скрипт принимает клиентские команды (команды сампа, других клео/плагинов). Левая клавиша мыши отправляет команду, правая - вставляет её в чат.
Настройка: вписывать команды нужно в hClickMenu-commands.txt. Список команд обновляется каждые 10 секунд.
Активация: по дэфолту клавишей CTRL, настроить можно командой /cmkey. Ввести команду и нажать на нужную клавишу, либо же в файле hClickMenu-settings.ini
Автор: hnnssy
Скрины:
Требования: SF 5.3
Спасибо legend2360 и FYP.
О найденых багах просьба сообщать здесь.
Source:
Настройка: вписывать команды нужно в hClickMenu-commands.txt. Список команд обновляется каждые 10 секунд.
Активация: по дэфолту клавишей CTRL, настроить можно командой /cmkey. Ввести команду и нажать на нужную клавишу, либо же в файле hClickMenu-settings.ini
Автор: hnnssy
Скрины:
Спасибо legend2360 и FYP.
О найденых багах просьба сообщать здесь.
Source:
CLEO:
{$CLEO}
{$INCLUDE SF}
0000:
repeat
wait 250
until 0AFA: is_samp_available
thread "ClMn"
msg "* /cs/ ClickMenu loaded %c%c hnnssy" 0xC1C1C1 47 47
CONST
CM_FONT = 0@
CM_XSIZE = 1@
CM_YSIZE = 2@
CM_XPOS = 3@
CM_YPOS = 4@
CM_COLVO = 5@
CM_KEY = 6@
CM_CMDLIST = 10@
CM_CMDBUFF = 11@
CM_CMDARRAYELEMENT = 12@
CM_CMDFILE = 30@
CM_BACKCOLOR = 0xFF1f1f1f
CM_BACKBORDERCOLOR = 0xFF141414
CM_ACTIVETEXTCOLOR = 0xFFC80000
CM_TEXTCOLOR 0xFFFFFFFF
END
if 8AAB: file_exists "CLEO\hClickMenu.cs"
then end_thread
end
if 8AAB: file_exists "CLEO\hClickMenu-settings.ini"
then
0AF1: write_int 17 to_ini_file "CLEO\hClickMenu-settings.ini" section "hCM" key "Key"
end
VAR
29@:int
CM_COLVO:int
CM_CMDARRAYELEMENT:int
CM_XSIZE:int
END
alloc CM_CMDLIST 800
memset CM_CMDLIST 0x0 800
alloc CM_CMDBUFF 20
memset CM_CMDLIST 0x0 20
if 8AAB: file_exists "CLEO\hClickMenu-commands.txt"
then
0A9A: CM_CMDFILE = openfile "CLEO\hClickMenu-commands.txt" mode "wt"
repeat
wait 0
until 0AAB: file_exists "CLEO\hClickMenu-commands.txt"
0A9B: closefile CM_CMDFILE
end
reg_cmd "cmkey" @cmkey
CM_FONT = Render.CreateFont("Tahoma", 8, 5)
gosub @refreshPos
gosub @refreshCMDs
gosub @refreshSize
33@ = 0
while true
wait 0
if 0ADC: "CLMN"
then
0A92: create_custom_thread "hClickMenu.cs"
end_thread
end
if and
33@ >= 10000
8B21: samp is_chat_opened
then
gosub @refreshCMDs
gosub @refreshSize
gosub @refreshXSize
CM_COLVO--
33@ = 0
end
0AF0: CM_KEY = get_int_from_ini_file "CLEO\hClickMenu-settings.ini" section "hCM" key "Key"
if and
8C7E: is_console_active
8B21: samp is_chat_opened
key CM_KEY
then
if CM_COLVO > 0
then
gosub @refreshPos
0B5D: samp toggle_cursor 1
0006: 13@ = CM_XPOS
000A: 13@ += CM_XSIZE
0006: 14@ = CM_YSIZE
0016: 14@ /= 2
000A: 14@ += CM_YPOS
call @CursorSetPos 2 13@ 14@
while key CM_KEY
wait 0
0BAF: samp CM_XPOS = get_input_info_ptr
0C0C: 31@ = struct CM_XPOS offset 8 size 4
0C0C: CM_XPOS = struct 31@ offset 8 size 4
0C0C: CM_YPOS = struct 31@ offset 12 size 4
CM_YPOS += 50
0B5D: samp toggle_cursor 1
0B6A: render draw_box_with_border_pos CM_XPOS CM_YPOS size CM_XSIZE CM_YSIZE color CM_BACKCOLOR border_size 2 border_color CM_BACKBORDERCOLOR
CM_XPOS += 5
CM_YPOS += 5
for CM_CMDARRAYELEMENT = 0 to CM_COLVO
0C1F: CM_CMDBUFF = string_array CM_CMDLIST element CM_CMDARRAYELEMENT size 20
call @renderClickableCMD 5 font CM_FONT cmd CM_CMDBUFF posXY CM_XPOS CM_YPOS color CM_TEXTCOLOR
CM_YPOS += 15
end
end
if 8B4C: samp is_dialog_active -1
then
0B8D: samp set_cursor_mode 0
end
end
end
if 20@ == 1
then
wait 100
while 20@ == 1
wait 0
printf "press the any key" 1
for 21@ = 0 to 230
if key 21@
then
0AF1: write_int 21@ to_ini_file "CLEO\hClickMenu-settings.ini" section "hCM" key "Key"
printf "new key: %d" 1500 21@
20@ = 0
end
end
end
end
end
:cmkey
20@ = 1
cmd_ret
:refreshPos
0B79: samp set_chat_input_enabled 1
0BAF: samp CM_XPOS = get_input_info_ptr
0C0C: 31@ = struct CM_XPOS offset 8 size 4
0C0C: CM_XPOS = struct 31@ offset 8 size 4
0C0C: CM_YPOS = struct 31@ offset 12 size 4
CM_YPOS += 50
0B79: samp set_chat_input_enabled 0
return
:CursorSetPos
{ ex: call @CursorSetPos 2 200 240 }
0AA2: 2@ = load_library "user32.dll"
0AA4: 3@ = get_proc_address "SetCursorPos" library 2@
0AA5: call 3@ num_params 2 pop 0 1@ 0@
ret 0
:refreshCMDs
if
0A9A: CM_CMDFILE = openfile "CLEO\hClickMenu-commands.txt" mode "rt"
then
CM_COLVO = 0
repeat
wait 0
memset CM_CMDBUFF 0x0 20
if 0AD7: read_string_from_file CM_CMDFILE to CM_CMDBUFF size 20
then
if 8AD6: end_of_file CM_CMDFILE reached
then
call @delete_last_char_from_string 1 CM_CMDBUFF
end
0C20: string_array CM_CMDLIST element CM_COLVO size 20 = CM_CMDBUFF
CM_COLVO += 1
end
until 0AD6: end_of_file CM_CMDFILE reached
0A9B: closefile CM_CMDFILE
end
return
:refreshXSize
for CM_CMDARRAYELEMENT = 0 to CM_COLVO
0C1F: CM_CMDBUFF = string_array CM_CMDLIST element CM_CMDARRAYELEMENT size 20
0C17: 29@ = strlen CM_CMDBUFF
29@ *= 8
29@ += 10
if 29@ > CM_XSIZE
then CM_XSIZE = 29@
end
end
return
:refreshSize
if CM_COLVO > 0
then
CM_COLVO--
0B6C: render CM_YSIZE = font CM_FONT draw_height
CM_YSIZE += 10
CM_XSIZE = 15
0012: CM_XSIZE *= CM_COLVO
000A: CM_YSIZE += CM_XSIZE
CM_COLVO++
CM_XSIZE = 100
end
return
const
ec_op_process = 1
ec_op_check = 2
end
:renderClickableCMD
// call @renderClickableText 5 font 0@ cmd 1@ posXY 2@ 3@ color 4@
if 1@ < 0
then 0AC6: 1@ = label 1@ offset
end
Render.DrawText(0@, 1@, 2@, 3@, 4@)
0B6B: render 20@ = font 0@ draw_text 1@ length
0B6C: render 21@ = font 0@ draw_height
if call @is_cursor_here 4 startXY 2@ 3@ offsetXY 20@ 21@
then
Render.DrawText(0@, 1@, 2@, 3@, CM_ACTIVETEXTCOLOR)
if call @eventClick2 1 const ec_op_check
then
0B79: samp set_chat_input_enabled 1
0B76: samp set_chat_input_text 1@
end
call @eventClick2 1 const ec_op_process
if call @eventClick 1 const ec_op_check
then
1@++
if 0C90: samp is_client_command_defined 1@
then
1@--
0C8F: samp process_chat_input 1@
else
1@--
say "%s" 1@
end
end
call @eventClick 1 const ec_op_process
end
ret 0
:eventClick
// call @eventClick 1 ec_operation 0@
if and
0@ >= ec_op_process
0@ <= ec_op_check
then
0AC6: 1@ = label @var_eventClick offset
0A8D: 2@ = read_memory 1@ size 1 virtual_protect 0
if 0@ == ec_op_process
then
if 2@ == true
then
if not key 1
then
0A8C: write_memory 1@ size 1 value false virtual_protect 0
end
else
if key 1
then
0A8C: write_memory 1@ size 1 value true virtual_protect 0
end
end
ret 0
end
if 0@ == ec_op_check
then
if 2@ == false
then
if key 1
then ret 0 1
end
end
end
end
ret 0
:var_eventClick
hex
00
end
:eventClick2
// call @eventClick 1 ec_operation 0@
if and
0@ >= ec_op_process
0@ <= ec_op_check
then
0AC6: 1@ = label @var_eventClick2 offset
0A8D: 2@ = read_memory 1@ size 1 virtual_protect 0
if 0@ == ec_op_process
then
if 2@ == true
then
if not key 2
then
0A8C: write_memory 1@ size 1 value false virtual_protect 0
end
else
if key 2
then
0A8C: write_memory 1@ size 1 value true virtual_protect 0
end
end
ret 0
end
if 0@ == ec_op_check
then
if 2@ == false
then
if key 2
then ret 0 1
end
end
end
end
ret 0
:var_eventClick2
hex
00
end
:is_cursor_here
// call @is_cursor_here 4 startXY 0@ 1@ endXY 2@ 3@
0B5E: get_cursor_pos 4@ 5@
if and
001D: 4@ > 0@
001D: 5@ > 1@
then
005A: 0@ += 2@
005A: 1@ += 3@
if and
001D: 0@ > 4@
001D: 1@ > 5@
then ret 0 1
end
end
ret 0
:delete_last_char_from_string
var
0@: int
1@: int
end
0C17: 1@ = strlen 0@
dec(1@)
0@ += 1@
0C11: memset 0@ 0 1
ret 0
Вложения
Последнее редактирование: