Jump to content

Help?


KraZ

Recommended Posts

How would i be able to trigger a client event from the serverside once a player logs in but only for that player so something like...

  
addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent("showTeamWindow", getRootElement()) 
end 
) 
  

but this shows the window(GUI) for every player instead of just the one who logs in... help me please?

Link to comment

Server-side

addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent(source, "showTeamWindow", source) 
end 
) 

Client-side

addEvent("showTeamWindow", true) 
addEventHandler("showTeamWindow", root, 
     function() 
          outputChatBox("Event triggered.", 0, 255, 0, false) 
     end 
) 

Link to comment

Thanks, Im not bad at scripting and don't normaly need to post here, Its just haven't scripted in a long time and can't remember alot of things, Ah well thanks anyways, There is my gamelobby and login script finished :D just the exp system and stuff now :D

Link to comment

Doesn't work btw, Gui doesn't display, heres client and serverside:

  
--Serverside 
  
addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent(source, "showTeamWindow", source) 
end 
) 
  

  
--Clientside 
  
addEvent("showTeamWindow", true) 
addEventHandler("showTeamWindow", root,  
function() 
  
    guiSetInputEnabled(true) 
    showCursor(true) 
     
    teamSelectionWindow = guiCreateWindow(489, 284, 388, 109, "Select a team:", false) 
    guiWindowSetSizable(teamSelectionWindow, false) 
  
    criminalButton = guiCreateButton(14, 31, 171, 54, "Criminals", false, teamSelectionWindow) 
    addEventHandler("onClientGUIClick", criminalButton, selectCrim, false) 
    guiSetFont(criminalButton, "default-bold-small") 
    guiSetProperty(criminalButton, "NormalTextColour", "FFAAAAAA") 
    copButton = guiCreateButton(195, 31, 171, 54, "Law Enforcement", false, teamSelectionWindow) 
    addEventHandler("onClientGUIClick", copButton, selectCop, false) 
    guiSetFont(copButton, "default-bold-small") 
    guiSetProperty(copButton, "NormalTextColour", "FFAAAAAA")     
end 
) 
  
  
  

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