Hero192 Posted February 3, 2016 Share Posted February 3, 2016 Hey guys, I want to set a text to a button while the player is frozen it should setText Unfreeze if not set Freeze. I tried that , but it doesn't works like I want, I want like when you Frozen a player in Admin Panel it shows, "Freeze" / "UnFreeze". Can anyone give me a hand? if (isElementFrozen(player)) then guiSetText (myButton, "Unfreeze") else guiSetText (myButton, "Freeze") end Thanks in advance. Link to comment
ViRuZGamiing Posted February 3, 2016 Share Posted February 3, 2016 Where is myButton this kinda important and show the function this code is in. Link to comment
Hero192 Posted February 3, 2016 Author Share Posted February 3, 2016 Where is myButton this kinda important and show the function this code is in. Its just a part of code Link to comment
ViRuZGamiing Posted February 3, 2016 Share Posted February 3, 2016 Where is myButton this kinda important and show the function this code is in. Its just a part of code Yes I understand this is part of your code but I need to see rest of it. Where mybutton is declared and where this part of your code is compaired to your declaration. Link to comment
Hero192 Posted February 3, 2016 Author Share Posted February 3, 2016 local myButton = guiCreateButton(574, 55, 95, 20, "Freeze", false, window) addEventHandler("onClientGUIClick",guiRoot, function () if (source == myButton) then local player = getPlayerFromName(guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid), 1)) if not player then return end triggerServerEvent("freezeplayer",localPlayer) if (isElementFrozen(player)) then guiSetText(myButton, "Unfreeze") else guiSetText(myButton, "Freeze") end end end) Link to comment
ViRuZGamiing Posted February 3, 2016 Share Posted February 3, 2016 local myButton = guiCreateButton (574, 55, 95, 20, "Freeze", false, window) addEventHandler("onClientGUIClick", myButton, function () local player = getPlayerFromName(guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid), 1)) outputServerLog("Player name (from grid): "..guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid), 1)) outputServerLog("Player name: "..getPlayerName(player)) if not player then return end triggerServerEvent("freezeplayer",localPlayer) if (isElementFrozen(player)) then guiSetText(myButton, "Unfreeze") else guiSetText(myButton, "Freeze") end end) Try this and see what I says Link to comment
Hero192 Posted February 3, 2016 Author Share Posted February 3, 2016 the grid works fine, the problem is I want do like admin panel of Lil Today, if you see the button "Freeze" if you frozen someone the button text change to freeze if the player selected is unfrozen and show unfreeze if the player who's selected is frozen. 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