Можно костыль сделать (16 строка)
{$CLEO}
0000:
repeat
wait 0
until samp.Available()
while true
wait 0
alloc 1@ 256
0B75: samp get_chat_string 99 text_to 1@ prefix_to 0 color_to 0 prefix_color_to 0
if 0C18: 2@ = strstr string1 1@ string2 "ТЕКСТ"
then
0AF0: 3@ = get_int_from_ini_file "cleo\Файл.ini" section "Счетчик" key "Кол-во"
000A: 3@ += 1
0AF1: write_int 3@ to_ini_file "cleo\Файл.ini" section "Счетчик" key "Кол-во"
chatmsg "запись сделана" -1 // Сбиваешь 99 строку любым сообщением, чтоб не было повторений
end
free 1@
end
{$CLEO}
{$INCLUDE SF}
0000:
IF 8AAB: file_exists "CLEO\test.ini"
THEN
0AF1: write_int 0 to_ini_file "cleo\test.ini" section "Counter" key "Key"
END
0BE3: raknet setup_incoming_rpc_hook @hook
0bde: 0
:hook
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
IF 0@ == RPC_SCRCLIENTMESSAGE
THEN
0BE5: raknet 0@ = get_hook_param PARAM_BITSTREAM
0BE7: raknet 1@ = bit_stream_read 0@ type BS_TYPE_INT
0BE7: raknet 2@ = bit_stream_read 0@ type BS_TYPE_INT
alloc 3@ 125
0BE8: raknet bit_stream 0@ read_array 3@ size 2@
0C1E: struct 3@ offset 2@ size 1 = 0
IF 0C18: 33@ = strstr string1 3@ string2 "ТЕКСТ"
THEN
0AF0: 4@ = get_int_from_ini_file "cleo\test.ini" section "Counter" key "Key"
000A: 4@ += 1
0AF1: write_int 4@ to_ini_file "cleo\test.ini" section "Counter" key "Key"
END
free 3@
END
0BE0: raknet hook_ret TRUE
Работает. Спасибо ^^
{$CLEO}
{$INCLUDE SF}
0000:
IF 8AAB: file_exists "CLEO\test.ini"
THEN
0AF1: write_int 0 to_ini_file "cleo\test.ini" section "Counter" key "Key"
END
0BE3: raknet setup_incoming_rpc_hook @hook
0bde: 0
:hook
0BE5: raknet 0@ = get_hook_param PARAM_PACKETID
IF 0@ == RPC_SCRCLIENTMESSAGE
THEN
0BE5: raknet 0@ = get_hook_param PARAM_BITSTREAM
0BE7: raknet 1@ = bit_stream_read 0@ type BS_TYPE_INT
0BE7: raknet 2@ = bit_stream_read 0@ type BS_TYPE_INT
alloc 3@ 125
0BE8: raknet bit_stream 0@ read_array 3@ size 2@
0C1E: struct 3@ offset 2@ size 1 = 0
IF 0C18: 33@ = strstr string1 3@ string2 "ТЕКСТ"
THEN
0AF0: 4@ = get_int_from_ini_file "cleo\test.ini" section "Counter" key "Key"
000A: 4@ += 1
0AF1: write_int 4@ to_ini_file "cleo\test.ini" section "Counter" key "Key"
END
free 3@
END
0BE0: raknet hook_ret TRUE
Есть вопрос.
Если мне нужно в этот же скрипт добавить еще один поиск текста, его можно прям туда засунуть? Или для каждого свой хук?
Т.е. мне нужно:
IF 0C18: 33@ = strstr string1 3@ string2 "ТЕКСТ"
THEN
0AF0: 4@ = get_int_from_ini_file "cleo\test.ini" section "Counter" key "Key"
000A: 4@ += 1
0AF1: write_int 4@ to_ini_file "cleo\test.ini" section "Counter" key "Key"
IF 0C18: 33@ = strstr string1 3@ string2 "ТЕКСТ ДВА"
THEN
0AF0: 4@ = get_int_from_ini_file "cleo\test.ini" section "Counter" key "Key"
000A: 4@ += 1
0AF1: write_int 4@ to_ini_file "cleo\test.ini" section "Counter" key "Key"