undefined Posted June 10, 2014 Share Posted June 10, 2014 (edited) Hi Guys. Im work on the notice panel. But i have a problem. When i clicked the sendButton, dx element show only for me. How can i show it to everyone? Edited June 17, 2014 by Guest Link to comment
xXMADEXx Posted June 10, 2014 Share Posted June 10, 2014 You have to trigger a server event, then trigger a client event for all of the players. Something like this: Client side (you) -> Server side -> Client (All clients) Link to comment
undefined Posted June 11, 2014 Author Share Posted June 11, 2014 (edited) Can you write the simple example? Edited June 12, 2014 by Guest Link to comment
xXMADEXx Posted June 11, 2014 Share Posted June 11, 2014 Here is a basic example that I made: btn = guiCreateButton ( 20, 20, 100, 20, "Click Me", false ) addEventHandler ( "onClientGUIClick", btn, function ( ) triggerServerEvent ( "OnClientClickedTheButton", localPlayer ) -- Send the request to the server end ) addEvent ( "OnClientClickedTheButton_Client", true ) -- Handle the response from the server addEventHandler ( "OnClientClickedTheButton_Client", root, function ( player ) outputChatBox ( getPlayerName ( player ).." clicked the button!" ) end ) -- server side -- addEvent ( "OnClientClickedTheButton", true ) -- Handle the request from the client addEventHandler ( "OnClientClickedTheButton", root, function ( ) triggerClientEvent ( root, "OnClientClickedTheButton_Client", root, source ) -- Send a response to the client end ) Link to comment
undefined Posted June 12, 2014 Author Share Posted June 12, 2014 Thnx bro. I'll try it. Link to comment
undefined Posted June 15, 2014 Author Share Posted June 15, 2014 (edited) It's show only for admins. My server side code: Client-Side Im how to show this everyone? Edited June 17, 2014 by Guest Link to comment
Max+ Posted June 15, 2014 Share Posted June 15, 2014 This is your Problem , local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "openGUI", thePlayer ) this Code, allow for admins only to open the gui , iam pretty sure you know what to do next . . , Link to comment
undefined Posted June 15, 2014 Author Share Posted June 15, 2014 But that's an notice panel. And only admins must be special. So I can not remove this code. How do I fix it in another way? Link to comment
Max+ Posted June 15, 2014 Share Posted June 15, 2014 But that's an notice panel. And only admins must be special. So I can not remove this code.How do I fix it in another way? I didn't get what you want you said you want it for all players no you say i want it for admins ? ? Link to comment
undefined Posted June 15, 2014 Author Share Posted June 15, 2014 Im create the gui panel. And write to my notice on the edit box and click the send button. Then added "onClientRender" event on the dxElement for all player. Also gui panel is only for admin , dx element is for everyone Link to comment
xXMADEXx Posted June 16, 2014 Share Posted June 16, 2014 Can you post your whole client code? Link to comment
undefined Posted June 16, 2014 Author Share Posted June 16, 2014 (edited) All-Client-Side-Code Edited June 17, 2014 by Guest Link to comment
xXMADEXx Posted June 17, 2014 Share Posted June 17, 2014 Try using this: addCommandHandler( "duyuru", function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( thePlayer, "openGUI", thePlayer ) end end ) addEvent ( "yaziGonder", true ) addEventHandler ( "yaziGonder", root, function ( text ) triggerClientEvent ( root, "yaziGeldi", root, text ) end ) -- client textFont = "pricedown" textScale = 1 text = nil local x, y = guiGetScreenSize () addEventHandler("onClientResourceStart", resourceRoot, function() duyuruGrid = guiCreateGridList((x/2)-(379/2), (y/2)-(230/2), 379, 230, false) guiSetAlpha(duyuruGrid, 0.65) guiSetVisible(duyuruGrid,false) isimLab = guiCreateLabel(0, 0, 379, 41, "Hubbub Games Duyuru Paneli", false, duyuruGrid) guiSetFont(isimLab, "default-bold-small") guiLabelSetColor(isimLab, 254, 255, 254) guiLabelSetHorizontalAlign(isimLab, "center", false) guiLabelSetVerticalAlign(isimLab, "center") duyuruMemo = guiCreateMemo(10, 51, 359, 94, "", false, duyuruGrid) default = guiCreateButton(10, 155, 99, 22, "Default-Bold", false, duyuruGrid) guiSetFont(default, "default-bold-small") bankgothic = guiCreateButton(140, 155, 99, 22, "Bankgothic", false, duyuruGrid) guiSetFont(bankgothic, "default-bold-small") pricedown = guiCreateButton(260, 155, 99, 22, "Pricedown", false, duyuruGrid) guiSetFont(pricedown, "default-bold-small") guiSetEnabled(pricedown, false) gonder = guiCreateButton(162, 197, 54, 23, "Gonder", false, duyuruGrid) guiSetFont(gonder, "default-bold-small") kapat = guiCreateButton(315, 197, 54, 23, "Kapat", false, duyuruGrid) guiSetFont(kapat, "default-bold-small") zorrom = guiCreateLabel(10, 205, 120, 15, "Script By: ZoRRoM", false, duyuruGrid) guiSetFont(zorrom, "default-bold-small") guiLabelSetHorizontalAlign(zorrom, "center", false) guiLabelSetVerticalAlign(zorrom, "center") addEventHandler("onClientGUIClick", getRootElement(), click) end ) function click () if (source == default) then guiSetEnabled(default, false) guiSetEnabled(bankgothic, true) guiSetEnabled(pricedown, true) textFont = "default-bold" textScale = 1 elseif (source == bankgothic) then guiSetEnabled(default, true) guiSetEnabled(bankgothic, false) guiSetEnabled(pricedown, true) textFont = "bankgothic" textScale = 0.8 elseif (source == pricedown) then guiSetEnabled(default, true) guiSetEnabled(bankgothic, true) guiSetEnabled(pricedown, false) textFont = "pricedown" textScale = 1 elseif (source == kapat) then guiSetVisible(duyuruGrid, false) showCursor(false) elseif (source == gonder) then text = guiGetText ( duyuruMemo ) guiSetEnabled(default, false) guiSetEnabled(bankgothic, false) guiSetEnabled(pricedown, false) guiSetEnabled(gonder, false) setTimer(function() guiSetEnabled(gonder, true) if (textFont == "pricedown") then guiSetEnabled(default, true) guiSetEnabled(bankgothic, true) guiSetEnabled(pricedown, false) elseif (textFont == "bankgothic") then guiSetEnabled(default, true) guiSetEnabled(bankgothic, false) guiSetEnabled(pricedown, true) elseif (textFont == "default-bold") then guiSetEnabled(default, false) guiSetEnabled(bankgothic, true) guiSetEnabled(pricedown, true) end end, 15000, 1 ) showCursor(false) guiSetVisible(duyuruGrid, false) triggerServerEvent ( "yaziGonder", localPlayer, guiGetText ( duyuruMemo ) ) end end setAlphaGradually = function( element, Speed ) if ( isElement( element ) and getElementType( element ):find( "gui-" ) and tonumber( Speed ) and tonumber( Speed ) >= 50 ) then if ( isTimer( Timer ) ) then killTimer( Timer ) end guiSetAlpha ( element, 0 ) Timer = setTimer ( function ( ) guiSetAlpha ( element, guiGetAlpha ( element ) + 0.03 ) if ( guiGetAlpha ( element ) >= 0.70 ) then killTimer( Timer ) end end, Speed, 0 ) else return false end end addEvent("openGUI", true) addEventHandler("openGUI", getRootElement(), function() setAlphaGradually( duyuruGrid, 50 ) guiSetVisible( duyuruGrid, not guiGetVisible( duyuruGrid ) ) showCursor( guiGetVisible( duyuruGrid ) ) end ) local dxText = "" addEvent ( "yaziGeldi", true ) addEventHandler ( "yaziGeldi", root, function( text ) dxText = text addEventHandler("onClientRender", root, dxElement ) setTimer(function() removeEventHandler("onClientRender", root, dxElement ) end, 15000, 1 ) end ) function dxElement( player ) dxDrawText("Duyuru: "..dxText.."\n- Hubbub Games Ekibi -", 11, 11, x, 58, tocolor(0, 0, 0, 255), textScale, textFont, "center", "top", false, true, true, true,false) dxDrawText("Duyuru: "..dxText.."#ffffff\n- Hubbub Games Ekibi -", 10, 10, x-1, 57, tocolor(255, 255, 255, 255), textScale, textFont, "center", "top", false, true, true,true, false) end 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