ice_brasil Posted June 19, 2013 Posted June 19, 2013 I want a single player can only use one button every 1 minute.I've done everything and nothing I've asked for some help scripters and it was not possible they do. I have 5 buttons I want a player can only use each button 1 in 1 minute. My buttons: GUIEditor.button[1] = guiCreateButton(164, 51, 96, 28, "Reparar Veículo", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF") GUIEditor.button[2] = guiCreateButton(29, 89, 96, 29, "Armas-1", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFFFFFF") GUIEditor.button[3] = guiCreateButton(29, 127, 96, 29, "Armas-2", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFFFFFF") GUIEditor.button[4] = guiCreateButton(164, 89, 96, 29, "Armas-3", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFFFFFF") GUIEditor.button[5] = guiCreateButton(164, 127, 97, 28, "Armas-4", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[5], "default-bold-small") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFFFFFF") GUIEditor.button[6] = guiCreateButton(30, 51, 95, 29, "Skin Colaborador", false, GUIEditor.gridlist[1]) guiSetFont(GUIEditor.button[6], "default-bold-small") guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFFFFFF") Functions I use the buttons: addEventHandler('onClientGUIClick',GUIEditor.button[2],arma,false) addEventHandler('onClientGUIClick',GUIEditor.button[3],arma2,false) addEventHandler('onClientGUIClick',GUIEditor.button[4],arma3,false) addEventHandler('onClientGUIClick',GUIEditor.button[5],arma4,false) addEventHandler('onClientGUIClick',GUIEditor.button[6],skin,false) addEventHandler('onClientGUIClick',GUIEditor.button[1],fix,false) Functions for each click: function arma ( ) triggerServerEvent('LoadServer',localPlayer) guiSetVisible (GUIEditor.window[1], false) showCursor (false) outputChatBox("Você pegou o kit de armas-1!") end function arma2 ( ) triggerServerEvent('LoadServer2',localPlayer) guiSetVisible (GUIEditor.window[1], false) showCursor (false) outputChatBox("Você pegou o kit de armas-2!") end function arma3 ( ) triggerServerEvent('LoadServer3',localPlayer) guiSetVisible (GUIEditor.window[1], false) showCursor (false) outputChatBox("Você pegou o kit de armas-3!") end function arma4 ( ) triggerServerEvent('LoadServer4',localPlayer) guiSetVisible (GUIEditor.window[1], false) showCursor (false) outputChatBox("Você pegou o kit de armas-4!") end function skin ( ) triggerServerEvent('LoadServer5',localPlayer) guiSetVisible (GUIEditor.window[1], false) showCursor (false) outputChatBox("Agora você esta usando a skin de colaborador!") end function fix ( ) if ( isPedInVehicle ( localPlayer ) ) then local theVehicle = getPedOccupiedVehicle ( localPlayer) local succes = fixVehicle ( theVehicle ) if ( succes ) then outputChatBox (" Veículo reparado. " ) else outputChatBox ( "Falha ao reparar seu veículo.") end else outputChatBox ( "Você precisa estar em um veículo!" ) end end What do I have to add that this is possible?
iPrestege Posted June 19, 2013 Posted June 19, 2013 local aButtons = { GUIEditor.button[1],GUIEditor.button[2],GUIEditor.button[3],GUIEditor.button[4],GUIEditor.button[5],GUIEditor.button[6] } addEventHandler('onClientGUIClick',root, function ( ) for i,v in ipairs ( aButtons ) do if source == v then if getElementData ( source,'AntiButtonFlood' ) == true then return outputChatBox('Wait 1 Minute!!') end setElementData ( source,'AntiButtonFlood',true ) setTimer ( setElementData,60000,1,source,'AntiButtonFlood',false ) end end end ) Try this .
ice_brasil Posted June 20, 2013 Author Posted June 20, 2013 Giving this did not work for flooding buttons
iPrestege Posted June 20, 2013 Posted June 20, 2013 debugscript 3 Also copy it again i forget something.
iPrestege Posted June 20, 2013 Posted June 20, 2013 Pres[T]ege: you forgeted other end lol Really ? Where's it .
iMr.3a[Z]eF Posted June 20, 2013 Posted June 20, 2013 addEventHandler('onClientGUIClick',root, function ( ) for i,v in ipairs ( aButtons ) do if source == v then if getElementData ( source,'AntiButtonFlood' ) == true then return outputChatBox('Wait 1 Minute!!') end setElementData ( source,'AntiButtonFlood',true ) setTimer ( setElementData,60000,1,source,'AntiButtonFlood',false ) end end end ) you wrote like this up^^
iPrestege Posted June 20, 2013 Posted June 20, 2013 What? You didn't change any think and i swear my code is right.
iMr.3a[Z]eF Posted June 20, 2013 Posted June 20, 2013 Never mind, i saw the other "end" next to ouputchatbox
ice_brasil Posted June 20, 2013 Author Posted June 20, 2013 Mr.Pres[T]ege you have skype? add my: icee_l pickture:reggae
Castillo Posted June 20, 2013 Posted June 20, 2013 No need for loops. local aButtons = { [ GUIEditor.button[1] ] = true, [ GUIEditor.button[2] ] = true, [ GUIEditor.button[3] ] = true, [ GUIEditor.button[4] ] = true, [ GUIEditor.button[5] ] = true, [ GUIEditor.button[6] ] = true } addEventHandler ( 'onClientGUIClick',root, function ( ) if ( aButtons [ source ] ) then if ( getElementData ( source,'AntiButtonFlood' ) == true ) then return outputChatBox ( 'Wait 1 Minute!!' ) end setElementData ( source,'AntiButtonFlood', true ) setTimer ( setElementData, 60000, 1, source, 'AntiButtonFlood', false ) end end )
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