Skip to content

Multiplayer Kick function - #231

Open
mccadecortez wants to merge 1 commit into
Norbyte:mainfrom
mccadecortez:main
Open

Multiplayer Kick function#231
mccadecortez wants to merge 1 commit into
Norbyte:mainfrom
mccadecortez:main

Conversation

@mccadecortez

Copy link
Copy Markdown

Hey 👋, I wanted to make a multiplayer perma-death mod & needed a way to kick people so they're not stuck spectating the game when I make the dead character a NPC.

Only issue with kickMsg->GetMessage().mutable_s2c_kick() is that it seems to be a extender message, which is causing clients without extender to crash; Otherwise I'm open to suggestions if there's a better way to implement this, thanks.

	Ex: `Ext.Net.Kick(userID, "kickMessage")`
@mccadecortez

Copy link
Copy Markdown
Author

Here's some lua code if someone wants to try the death on kick.

Ext.Osiris.RegisterListener("Died", 1, "after", function (character)
    local userID = Ext.Entity.Get(character).UserReservedFor.UserID
    local hostID = Ext.Entity.Get(GetHostCharacter()).UserReservedFor.UserID

    _P(userID, hostID)

    if (userID ~= hostID) then
        MakeNPC(character)
        Ext.Net.Kick(userID, "You died!")
    end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant