Получение id и названий отправляемых и получаемых rpc/пакетов

chapo

tg/inst: @moujeek
Автор темы
Всефорумный модератор
9,133
12,263
Версия MoonLoader
.026-beta
Не выводятся названия рпс и пакетов, что не так?
Lua:
local sampev = require 'lib.samp.events'

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
    end
end

function onReceivePacket(id, bitStream)
    sampAddChatMessage('id: '..id..' BitS: '..bitStream, -1)
    local name = raknetGetPacketName(id)
    if not name == nil then
        sampAddChatMessage('PACKET: '..name, -1)
    end
end

function onReceiveRpc(id, bitStream)
    sampAddChatMessage('RPC: id: '..id..' BitS: '..bitStream, -1)
    name = raknetGetRpcName(id)
    if not name == nil then
        sampAddChatMessage('RPC: '..name, -1)
    end
end
1606330079147.png
 

damag

Женюсь на официантке в моем любимом баре
Проверенный
1,151
1,205
  • Нравится
Реакции: chapo

chapo

tg/inst: @moujeek
Автор темы
Всефорумный модератор
9,133
12,263
название не выводятся, только ид.
ид их название тут.
То есть мне придется делать как-то так?:

Lua:
function onReceivePacket(id, bitStream)
    sampAddChatMessage('id: '..id..' BitS: '..bitStream, -1)
    if id == 26 then sampAddChatMessage('RPC_ENTERVEHICLE', -1) end
end
 

damag

Женюсь на официантке в моем любимом баре
Проверенный
1,151
1,205

chapo

tg/inst: @moujeek
Автор темы
Всефорумный модератор
9,133
12,263
AIR в 2016 году на клео написал по нормальному без этого гемора

CLEO:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
wait 0
   SAMP.Available
else_jump @Label000002
0@ = 0
1@ = 0
8@ = 0
Dialog.Create(5@, "Record RPC/Packet by AIR")
Dialog.SetRECT(5@, 500, 500, 200, 70)
Dialog.AddCheckBox(5@, 1, "Record RPC", 0, 0, 200, 20)
Dialog.AddCheckBox(5@, 2, "Record Packet", 0, 30, 200, 20)
Dialog.SetVisible(5@, 0)
0BE1: raknet setup_outcoming_rpc_hook -943
0BE2: raknet setup_outcoming_packet_hook -1539
0BE3: raknet setup_incoming_rpc_hook -652
0BE4: raknet setup_incoming_packet_hook -1236
wait 0
if
   Dialog.PopEvent(5@, 6@, 7@)
else_jump @Label00023A
if
  6@ == 1025
else_jump @Label00023A
if
  7@ == 1
else_jump @Label000189
if
   Dialog.CheckBoxIsChecked(5@, 7@)
else_jump @Label00012F
0@ = 1
printf "~g~Start RPC Recording" 500
jump @Label000189
0@ = 0
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label000170
printf "~g~Save..." 500
jump @Label000189
printf "~g~End RPC Record" 500
if
  7@ == 2
else_jump @Label00023A
if
   Dialog.CheckBoxIsChecked(5@, 7@)
else_jump @Label0001DD
1@ = 1
printf "~g~Start Packet Recording" 500
jump @Label00023A
1@ = 0
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label00021E
printf "~g~Save..." 500
jump @Label00023A
printf "~g~End Packet Record" 500
if
0ADC:   test_cheat "RRP"
else_jump @Label000285
0B12: 8@ = 8@ XOR 1
if
  8@ == 1
else_jump @Label00027A
Dialog.SetVisible(5@, 1)
SAMP.ToggleCursor(1)
jump @Label000285
Dialog.SetVisible(5@, 0)
SAMP.ToggleCursor(0)
jump @Label0000B1
if
  0@ == 1
else_jump @Label0003AB
0BE5: raknet 2@ = get_hook_param 1
0BF8: raknet 3@ = get_rpc_name 2@
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label000348
4@ = File.Open("CLEO\RecordR-P.txt", "at")
0AD9: write_formatted_text "RPC ID: %d, RPC Name: %s (Incoming) by AIR %c" in_file 4@ 2@ 3@ 10
printf "~g~Record..." 500
File.Close(4@)
jump @Label0003A0
printf "No File '%s'!~n~RPC ID: %d, RPC Name: %s ~n~(Incoming)" 500 "CLEO\RecordR-P.txt" 2@ 3@
0BE0: raknet hook_ret 1
jump @Label0003AF
0BE0: raknet hook_ret 1
if
  0@ == 1
else_jump @Label0004D0
0BE5: raknet 2@ = get_hook_param 1
0BF8: raknet 3@ = get_rpc_name 2@
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label00046C
4@ = File.Open("CLEO\RecordR-P.txt", "at")
0AD9: write_formatted_text "RPC ID: %d, RPC Name: %s (Outcoming) by AIR %c" in_file 4@ 2@ 3@ 10
printf "~g~Record..." 500
File.Close(4@)
jump @Label0004C5
printf "No File '%s'!~n~RPC ID: %d, RPC Name: %s ~n~(Outcoming)" 500 "CLEO\RecordR-P.txt" 2@ 3@
0BE0: raknet hook_ret 1
jump @Label0004D4
0BE0: raknet hook_ret 1
if
  1@ == 1
else_jump @Label0005FF
0BE5: raknet 2@ = get_hook_param 1
0BF9: raknet 3@ = get_packet_name 2@
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label000596
4@ = File.Open("CLEO\RecordR-P.txt", "at")
0AD9: write_formatted_text "Packet ID: %d, Packet Name: %s (Incoming) by AIR %c" in_file 4@ 2@ 3@ 10
printf "~g~Record..." 500
File.Close(4@)
jump @Label0005F4
printf "No File '%s'!~n~Packet ID: %d, Packet Name: %s ~n~(Incoming)" 500 "CLEO\RecordR-P.txt" 2@ 3@
0BE0: raknet hook_ret 1
jump @Label000603
0BE0: raknet hook_ret 1
if
  1@ == 1
else_jump @Label000730
0BE5: raknet 2@ = get_hook_param 1
0BF9: raknet 3@ = get_packet_name 2@
if
0AAB:   file_exists "CLEO\RecordR-P.txt"
else_jump @Label0006C6
4@ = File.Open("CLEO\RecordR-P.txt", "at")
0AD9: write_formatted_text "Packet ID: %d, Packet Name: %s (Outcoming) by AIR %c" in_file 4@ 2@ 3@ 10
printf "~g~Record..." 500
File.Close(4@)
jump @Label000725
printf "No File '%s'!~n~Packet ID: %d, Packet Name: %s ~n~(Outcoming)" 500 "CLEO\RecordR-P.txt" 2@ 3@
0BE0: raknet hook_ret 1
jump @Label000734
0BE0: raknet hook_ret 1