Jump to content

Recommended Posts

I want to listen for event when player joinin. So I code this in modmain.lua

When I start the game as common server(no dedicated), and there are homesigns in the world, I'll get the print "playeractivated". 

But if I start the game as dedicated server,(also the world has homesigns) when I join in the server as client ,I got " ListenForEvent(playeractivated)" printed at Server end, but no "playeractivated". I don't know why..

 

Dedicated server's TheWorld won't push "playeractivated" event?   Or client player's joinin won't trigger the event?

 

local function AddListenEvent(inst)
      if  GLOBAL.TheWorld.ismastersim then   
       inst:ListenForEvent("playeractivated", function(inst,player) print "playeractivated" end, GLOBAL.TheWorld)          ---work properly in common server ,why not in dedicated server?
        print "ListenForEvent(playeractivated)"    
      end

 

AddPrefabPostInit("homesign", AddListenEvent)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...