STALKER | TOGETHER

Obtaining classes from luabind functions

SteamGameManager()

This function is used to obtain the CSteamSocketGameManager class.
Check lua_help_mp.lua to understand what you want to do.
Example:
local GameManager = SteamGameManager()

SteamServer()

This function is used to obtain the CSteamSocketServer class.
Check lua_help_mp.lua to understand what you want to do.
Example:
local ServerSOSOCK = SteamServer()

SteamClient()

This function is used to obtain the CSteamSocketClient class.
Check lua_help_mp.lua to understand what you want to do.
Example:
local ClientSOSOCK = SteamClient()

GetPlayerManager()

This function is used to obtain the CSteamSocketGameManager class.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    local PlayerManager = GameManager:GetPlayerManager()
}

Object spawning and destruction functions

alife_create_client(section, position, lv_id, gv_id, id_parent)

This function is used to remotely spawn an object on the host side from a client without waiting.
Sends a spawn entity request to the host. The host spawns the object.
Example:
alife_create_client("box", db.actor:position(), 0, 0)

alife_create_awaite(functa, section, position, lv_id, gv_id, id_parent)

This function is used to remotely spawn an object on the host side from a client with waiting.
Sends a spawn entity request to the host. The host spawns the object. The client catches the event and calls functa(se_object)
Example:
{
    alife_create_awaite(function(se)
        if se then
            log("Object box spawned: "..box:section_name())
        end
    end, "box", db.actor:position(), 0, 0)
}

alife_release_client(se_object)

This function is used to remotely despawn an object on the host side from a client by se_object.
Sends a despawn entity request to the host. The host despawns the object.
Example:
alife_release_client(alife_object(55))

alife_release_client_id(id)

This function is used to remotely despawn an object on the host side from a client by id.
Sends a despawn entity request to the host. The host despawns the object.
Example:
alife_release_client_id(55)

Player manager functions

TeleportPlayer(u32 NetID, Fvector Position)

This function is used to teleport a player to a position. THIS IS A HOST ACTION!
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    local PlayerManager = GameManager:GetPlayerManager()
    local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
    if pdata then
        local id = pdata:GetNetID()
        local pos = db.actor:position()
        PlayerManager:TeleportPlayer(id, pos)
    end
}

SendToAnotherLevel(u32 NetID, Fvector Position, u32 gvid, u32 lvid, Fvector Angle)

This function is used to teleport a player to a position or level. THIS IS A HOST ACTION! Advanced version.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    local PlayerManager = GameManager:GetPlayerManager()
    local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
    if pdata then
        local id = pdata:GetNetID()
        local pos = db.actor:position()
        local lvid = db.actor:level_vertex_id()
        local gvid = db.actor:game_vertex_id()
        PlayerManager:SendToAnotherLevel(id, pos, gvid, lvid, db.actor:direction())
    end
}

KickPlayer(u32 NetID)

This function is used to kick a player. THIS IS A HOST ACTION!
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    local ServerSOSOCK = SteamServer()
    local PlayerManager = GameManager:GetPlayerManager()
    local pdata = PlayerManager:GetPlayerDataAtIndex(1) -- HOST IS 0
    if pdata then
        local id = pdata:GetNetID()
        PlayerManager:KickPlayer(id)
    else
        local NETid = ServerSOSOCK:get_player_by_index(1) -- HOST IS 0
        PlayerManager:KickPlayer(NETid)
    end
}

Weather and time synchronization functions

OnTimeChanged()

This function is used to synchronize time with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    GameManager:OnTimeChanged()
}

OnWeatherChanged()

This function is used to synchronize weather with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    GameManager:OnWeatherChanged()
}

OnWeatherFXChanged()

This function is used to synchronize weather effects with clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    GameManager:OnWeatherFXChanged()
}

Custom actions synchronization functions

OnICustomScriptAction()

This function is used to send custom action to clients.
Check lua_help_mp.lua to understand what you want to do.
Example:
{
    local GameManager = SteamGameManager()
    GameManager:OnICustomScriptAction("ui_sleep_dialog.sleep_test", false)
}