problem with noping packets

Тема в разделе "Non-Russian", создана пользователем praiki, 7 апр 2019.

  1. praiki

    praiki Участник

    Регистрация:
    20 апр 2018
    Сообщения:
    16
    Симпатии:
    0
    
    call @NOPVehicleData 0
    
    :NOPVehicleData
    0BE2: raknet setup_outcoming_packet_hook @NOPVehicleData
    0BE5: raknet [email protected] = get_hook_param 1
    IF
    [email protected] == 200
    THEN
    0BE0: raknet hook_ret false
    END
    0BE0: raknet hook_ret true
    0AB2: ret 0

    this is my snippet, when i call it my game freezes and gaves me error warnings. what's the problem?
     
  2. F11GAR0.

    F11GAR0. Постоянный участник

    Регистрация:
    8 июн 2017
    Сообщения:
    87
    Симпатии:
    88
  3. asdzxcjqwe

    asdzxcjqwe непонел
    Проверенный

    Регистрация:
    13 фев 2017
    Сообщения:
    408
    Симпатии:
    296
    1) the 0BE2 opcode should be called right after the script is initialized (at the beginning of the code)
    2) you don't have to call the label that is used for hooking

    for example:
    {$CLEO}
    0000: NOP // we use this instead of 03A4
    $nop = false // would it be enabled(true) or disabled(false) by default
    
    // waiting for samp to be initialized
    while not SAMP.Available()
        wait 0
    end
    
    0BE2: raknet setup_outcoming_packet_hook @hook
    0B34: samp register_client_command "toggle" to_label @cmd_toggle
    chatmsg "The script is initialized" -1 // just to be sure, you don't actually have to use it
    
    // infinite loop
    while true
        wait 0
        // a part of the code that is executing non-stop, it's never going to end unless a BREAK is called
    end
    
    :hook
    0BE5: raknet [email protected] = get_hook_param 1
    if and
        [email protected] == 200
        $nop == true
    then
        0BE0: raknet hook_ret false // if enabled, hook this
    end
    0BE0: raknet hook_ret true // if disabled, skip hooking
    
    :cmd_toggle
    0B12: $nop = $nop XOR 1
    if $nop == true
    then chatmsg "NOP \"Vehicle Data\" is turned {00dd00}on" -1
    else chatmsg "NOP \"Vehicle Data\" is turned {dd0000}off" -1
    end
    SAMP.CmdRet()

    see also these examples so you can completely make it out (these are decompiled scripts that use hooking as well)
     

    Вложения:

    #3 asdzxcjqwe, 7 апр 2019
    Последнее редактирование: 7 апр 2019
    social enemy и Snagg нравится это.