Jump to content

[Help] onPlayerJoin panel


Hunter567T

Recommended Posts

I am trying to make a panel that appears when a player connects to a server. But when someone connects it is not appearing..

Code:

Client

  
local resX, resY = guiGetScreenSize() 
  
function createGUI(thePlayer) 
    cWindow =   guiCreateWindow((resX/2)-315,(resY/2)-100,629,200,"Welcome Panel By Hunter567T",false) 
    message =   guiCreateButton(0,0.1,2, 0.9,"............",true,cWindow) 
    close =     guiCreateButton(0.4,0.825,0.213,0.1,"Close",true,cWindow) 
    addEventHandler("onClientGUIClick", close, closeCgui, false) 
    guiSetVisible (cWindow, false) 
end 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createGUI) 
  
function openGUI(thePlayer) 
    if (cWindow ~= nil) then 
        guiSetVisible(cWindow, true) 
        showCursor(true) 
    end 
end 
addEvent("makeGUI", true) 
addEventHandler("makeGUI", getLocalPlayer(), openGUI) 
  
function closeCgui() 
    guiSetVisible (cWindow, false) 
    showCursor(false) 
end 
  

Server

  
  
function GUIness(source) 
        triggerClientEvent(source, "makeGUI", root) 
    end 
addEvent("onPlayerJoin", true ) 
addEventHandler("onPlayerJoin", GUIness) 
  

Link to comment
triggering client event from server side on onPlayerJoin event will fail - players join imediately, but need to download and start resources - which takes time.

Why don't you just show gui from clientside? ( onClientResourceStart attached to getResourceRootElement(getThisResource()) )

That's what he's doing but for some reason he hides it just after creating it...

Link to comment
triggering client event from server side on onPlayerJoin event will fail - players join imediately, but need to download and start resources - which takes time.

Why don't you just show gui from clientside? ( onClientResourceStart attached to getResourceRootElement(getThisResource()) )

Everything fromt the client is there only thing i removed is the text in the message ( "..........." ) im confused as well now.. Also would onPlayerLogin instead of onPlayerJoin help?

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