Nameless Posted June 29, 2012 Share Posted June 29, 2012 Hi, I have a problem with showing my GUI window; -- How do I give the status (true or false) to set the window visible? -- If I press "F10" (as an admin the window gets visible for everybody Is there a way I can fix this? If you dont understand my problem, please ask! Here is my code: --Server script, checking if logged in player is admin local root = getRootElement() addEventHandler("onPlayerLogin", root, function() if ( hasObjectPermissionTo ( source, "function.aclSetRight", false ) ) then bindKey(source, "F10", "down", function(player, key, state) triggerClientEvent("showMsgWdw", getRootElement()) end) end end ) --Client script to set window visible function showMessageWindow(status) --check if function should show or hide window if status ~= true and status ~= false then status = not guiGetVisible(msgWindow) end if status == true then guiSetInputEnabled(true) guiSetVisible(msgWindow, true) showCursor(true) else guiSetInputEnabled(false) guiSetVisible(msgWindow, false) showCursor(false) end end addEvent( "showMsgWdw", true ) addEventHandler( "showMsgWdw", getRootElement(), showMessageWindow ) I really hope you guys can find a sollution for my problem! Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 If I press "F10" (as an admin the window gets visible for everybodyChangetriggerClientEvent("showMsgWdw", getRootElement()) to triggerClientEvent(player,"showMsgWdw", getRootElement()) How do I give the status (true or false) to set the window visible? What do you mean? Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 you dont know what are you doing --Server script function setVisible(player,key,keyState ) -- our function local accName = getAccountName ( getPlayerAccount ( player ) ) -- get player account if (keyState == "down") then -- if player pressed on "f10" then if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then -- if player have admin rights then triggerClientEvent("showMsgWdw", getRootElement()) -- call client for show window else -- if not outputChatBox ('#ffffffERROR: #ffffffYou not admin',player,255,255,255,true) -- outputchatbox end end end bindKey ( player, "F10", "down", setVisible ) -- bind on f10 our function --Client script to set window visible function showMessageWindow() -- function for trigger if (guiGetVisible(msgWindow) == true) then -- if window opened then guiSetVisible (msgWindow,false ) -- close window showCursor(false) --disable cursor guiSetInputEnabled(false) --disable input focus else guiSetVisible (msgWindow,true ) enable --//-- showCursor(true) -- enable --//-- guiSetInputEnabled(true) --enable --//-- end end addEvent( "showMsgWdw", true ) -- our event addEventHandler( "showMsgWdw", getRootElement(), showMessageWindow ) -- attach our trigger to function Link to comment
Guest Guest4401 Posted June 29, 2012 Share Posted June 29, 2012 (edited) In your code, Pressing F10 will show window to everyone. Edited June 29, 2012 by Guest4401 Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 he want if guy pressed on f10, the window show to everyone,.. i'm made it Link to comment
Nameless Posted June 29, 2012 Author Share Posted June 29, 2012 If I press "F10" (as an admin the window gets visible for everybodyChangetriggerClientEvent("showMsgWdw", getRootElement()) to triggerClientEvent(player,"showMsgWdw", getRootElement()) How do I give the status (true or false) to set the window visible? What do you mean? Thank you for your reply! I changed the triggerClientEvent, but the window doesnt show up anymore.. For some reason the showMessageWindow function is not executed. Link to comment
Nameless Posted June 29, 2012 Author Share Posted June 29, 2012 he wantif guy pressed on f10, the window show to everyone,.. i'm made it Thanks for your reply, but I dont want to show the window to everybody! I want it to show to the admin who pressed F10 Link to comment
Nameless Posted June 29, 2012 Author Share Posted June 29, 2012 The script only executes server scripts.. but not the client ones Link to comment
Castillo Posted June 29, 2012 Share Posted June 29, 2012 --Server script, checking if logged in player is admin addEventHandler ( "onPlayerLogin", root, function ( ) if ( hasObjectPermissionTo ( source, "function.aclSetRight", false ) ) then bindKey ( source, "F10", "down", onKeyUse ) end end ) function onKeyUse ( thePlayer ) triggerClientEvent ( thePlayer, "showMsgWdw", thePlayer ) end Link to comment
Nameless Posted June 29, 2012 Author Share Posted June 29, 2012 Thank you all for helping me with my problem! The client script wasn't working because there was a -- missing for a comment Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 Thank you all for helping me with my problem!The client script wasn't working because there was a -- missing for a comment you are welcome Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now