Jump to content

OnResourceStart


StefanAlmighty

Recommended Posts

Okay I want a GUI to appear for all players who are logged out once a resource starts.

function onAccountsStart() 
    local players = getElementsByType ( "player" ) 
    for theKey, thePlayer in ipairs(players) do 
        if getElementData(thePlayer, "account:logged") == false then 
            triggerClientEvent(thePlayer, "loadLoginPanel", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onAccountsStart) 

It loops through all players and if account:logged is false then it triggers a client event. But for some reason, it isn't triggering the event and is not giving off any errors in the console or debugscript. Any help is appreciated.

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