Jump to content

error with onplayerjoin


Kewun

Recommended Posts

Posted

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?

Posted

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)

 

Posted

Waste of time simply replace MessagePlayer with outputChatBox() 

outputChatBox("Welcome to the kewun's beta test server",source)

You don't need to use this function.

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

 

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...