register_scripted_game_event_hook

Registers a function which gets called on every received scripted game event. It returns an ID used for unregistering the hook. Hoook should either return true or false.

int register_scripted_game_event_hook(function(int sender, int count, array<int> args) callback)

function mySGEhook(sender, count, args)
    g_logger.log_info("Script Event from "..PLAYER.GET_PLAYER_NAME(player)) 
    g_logger.log_info("SE Hash: " .. tostring(args[1]) .. " Last Arg: " .. tostring(args[count]))
    
    if (args[1] == 1337) then
        return false -- false to block
    end
    
    return true
end

Last updated