Jump to content

error with onplayerjoin


Kewun

Recommended Posts

function MessagePlayer(text)
    outputChatBox(text,source)
end
function onGraczJoin()
    MessagePlayer("Welcome to the kewun's beta test server")
    spawnPlayer(source, 0,0,5,0,0,0)
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
addEventHandler("onPlayerJoin", getRootElement(), onGraczJoin)

 

then after i join server, i get black screen, how to fix this?

Link to comment

You need a player parameter on the MessagePlayer function. Source will be nil. Fix below.

function MessagePlayer(player,text)
  outputChatBox(text,player)
end

function onGraczJoin()
  MessagePlayer(source,"Welcome to the kewun's beta test server")
  spawnPlayer(source, 0,0,5,0,0,0)
  -- Insert rest of code here
end
addEventHandler("onPlayerJoin", getRootElement(), onGraczJoin)

 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...