Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer Kick function #231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mccadecortez
Copy link

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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant