on_event(function)

returns function(sender id, event_index, args)

local SCRIPT_EVENT = {
    SCRIPT_EVENT_GENERAL = 800157557,
    GENERAL_EVENT_TYPE_PLAYER_JUST_SPAWNED = -1140092619,
}

script_events.on_event(function(sender_id, event_index, args)
    if event_index == SCRIPT_EVENT.SCRIPT_EVENT_GENERAL then
        local event_type = args[3]
        if event_type == SCRIPT_EVENT.GENERAL_EVENT_TYPE_PLAYER_JUST_SPAWNED then
            log.info(NETWORK.NETWORK_GET_PLAYER_NAME(sender_id) .. " just joined the session.")
            notification.show(NETWORK.NETWORK_GET_PLAYER_NAME(sender_id) .. " just joined the session.")
        end
    end
end)

Last updated