Possible to catch player joins/parts client side?

gimmicgimmic Join Date: 2013-03-02 Member: 183555Members
Is it possible to hook player joins / quits from a client at all?

Comments

  • IronsoulIronsoul Join Date: 2011-03-12 Member: 86048Members
    I'm terrible at ns2 modding, but I would guess you could set up some sort of thing to hook into the server side client connect / disconnect then send a message to the client and have some stuff happen.
  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    Indeed...

    In Client.lua
    local function OnClientConnected()
    end
    
    local function OnClientDisconnected()
    end
    
    Event.Hook("ClientDisconnected", OnClientDisconnected)
    Event.Hook("ClientConnected", OnClientConnected)
    


    Pro-Tip of the Day: CTRL+SHIFT+F is your best friend in Decoda
  • gimmicgimmic Join Date: 2013-03-02 Member: 183555Members
    edited April 2013
    yes, but that's all sever side. Specifically I was looking client side only.

    If I remember correctly, the client connect/disconnect there is *your* client connecting or disconnecting as a status. Not other players.
  • TyrsisTyrsis Join Date: 2002-11-15 Member: 8804Members
    edited April 2013
    That's not server side, that is client side, though all that is tracking is your own client, not others. You weren't very clear on what you want to do. I'm assuming you want to be able to access some sort of client data when other clients connect? If you want to do that, you'll have to setup and send network messages from the server -> client when other clients connect and disconnect. That process is rather easy. Unfortunately if you're only doing a client side mod, then there's no much that can be done, as that data isn't passed. The only thing you could do is parse out the player is connected message that happens on a setname that is broadcasted, which is a bit of a kludge.

    There also may be other kludgey ways of doing it buried in the client code (ie: the scoreboard needs to be updated when a user connects/disconnects).
  • SolarisSolaris Join Date: 2003-05-11 Member: 16213Members
    Does LUA/NS2 allow for a "cron" type of event? You could then just check the sv_status return value every x seconds, see what's changed and do stuff with it. And that should all be client side.
    But I never tried modding NS2, I'm just throwing in some noob-ish idea, so maybe I'm completely wrong :D
Sign In or Register to comment.