Bishop_G Posted October 4, 2023 Share Posted October 4, 2023 Hi Community, I created a panel for players to enter missions.There are names of the missions in the gridlists. But I do not want two players to enter the same mission.To prevent this, I gave data to the button to select the mission, and even if a second player clicks on that button, second player cannot enter the mission. The mission is on the server side and I want to give false data to the gui button when the mission is completed. How can I do this? How can I give false data to the gui button from the server side? can you help me ? function GoMission() if ( source == spawnButton ) then if getElementData(spawnButton,"paparazziFull") then return end --Other player cannot enter the mission local name = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if name == "Kill The Paparazzi" then setElementData(spawnButton,"paparazziFull",true) ----- There is someone in mission triggerServerEvent("PaparazziStart",localPlayer,localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) playSoundFrontEnd ( 6) elseif name == "Andre Must Die" then triggerServerEvent("andreStart",localPlayer,localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) playSoundFrontEnd ( 6) elseif name == "Cleaning The Hood" then triggerServerEvent("DrugDealerStart",localPlayer,localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) playSoundFrontEnd ( 6) elseif name == "Rifas Die In Vinewood" then triggerServerEvent("rifaStart",localPlayer,localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) playSoundFrontEnd ( 6) end end end addEventHandler("onClientGUIClick",spawnButton,GoMission) Link to comment
Hydra Posted October 4, 2023 Share Posted October 4, 2023 By saying: Quote How can I give false data to the gui button from the server side? Do you mean how to disable that button? If yes then you could use --// Client addEvent("ButtonState", true) addEventHandler("ButtonState", root, function(state) if state == true then guiSetEnabled(spawnButton, true) elseif state == false then guiSetEnabled(spawnButton, false) end end) --// Server addCommandHandler("button", function(player, cmd, newstate) if not newstate then return end triggerClientEvent(player, "ButtonState", player, newstate) end) Link to comment
Bishop_G Posted October 4, 2023 Author Share Posted October 4, 2023 No. Players are teleported to the mission from the gui panel. But I want there to be only one player in the mission. That's why I gave an element data to the gui button. But I want to set this element data to false when the mission is finished from the server side. I don't know how to do this. For example, there is onPlayerWasted on the server side. When the player dies, the mission is canceled. In other words, when the player dies, the button on the gui panel must now be active. I will set the gui button element to false. But I don't know how to do this in the onPlayerWasted event on the server side. Link to comment
alex17" Posted October 4, 2023 Share Posted October 4, 2023 7 hours ago, Bishop_G said: No. Players are teleported to the mission from the gui panel. But I want there to be only one player in the mission. That's why I gave an element data to the gui button. But I want to set this element data to false when the mission is finished from the server side. I don't know how to do this. For example, there is onPlayerWasted on the server side. When the player dies, the mission is canceled. In other words, when the player dies, the button on the gui panel must now be active. I will set the gui button element to false. But I don't know how to do this in the onPlayerWasted event on the server side. You can use a variable and set it to true when someone starts the mission and false when it ends, when someone wants to start that mission they can only do so if the variable is false local isMissionStarted = false addEvent("requestStartMission", true) addEventHandler("requestStartMission", root, function() if not isMissionStarted then startMision() else outputChatBox("Mission not available right now", client, 255, 0, 0) end end ) function startMision() isMissionStarted = true end function stopMision() isMissionStarted = false end 1 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