ice_brasil Posted June 19, 2013 Share Posted June 19, 2013 I made this script for when the player clicks the button GUIEditor.button [1] your vehicle is repaired What did this wrong? I used AddEventHandler inside the window gui addEventHandler('onClientGUIClick',GUIEditor.button[1],fix,false) and out the window I used: function fix ( thePlayer, commandName) if ( isPedInVehicle ( thePlayer ) ) then local theVehicle = getPedOccupiedVehicle ( thePlayer) local succes = fixVehicle ( theVehicle ) if ( succes ) then outputChatBox (" Vehicle fixed. ", thePlayer ) else outputChatBox ( "Failed to fix your vehicle.", thePlayer) end else outputChatBox ( "You must be in a vehicle!", thePlayer ) end end What did this wrong? why is not repairing the vehicle? Link to comment
iPrestege Posted June 19, 2013 Share Posted June 19, 2013 function fix ( ) if ( isPedInVehicle ( localPlayer ) ) then local theVehicle = getPedOccupiedVehicle ( localPlayer) local succes = fixVehicle ( theVehicle ) if ( succes ) then outputChatBox (" Vehicle fixed. " ) else outputChatBox ( "Failed to fix your vehicle.") end else outputChatBox ( "You must be in a vehicle!" ) end end Link to comment
ice_brasil Posted June 19, 2013 Author Share Posted June 19, 2013 One more doubt '-' how do I make the player can only use this button every 1 minute? Link to comment
Castillo Posted June 19, 2013 Share Posted June 19, 2013 You can use a timer or getTickCount, search the forum, I helped another person with the same issue. Link to comment
xXMADEXx Posted June 19, 2013 Share Posted June 19, 2013 You can use a timer or getTickCount, search the forum, I helped another person with the same issue. + guiSetEnabled Link to comment
ice_brasil Posted June 19, 2013 Author Share Posted June 19, 2013 I've never used this function could add for me, so I've seen how to use. Link to comment
Castillo Posted June 19, 2013 Share Posted June 19, 2013 You can use a timer or getTickCount, search the forum, I helped another person with the same issue. + guiSetEnabled Not required. @ice_brasil: Why are you so lazy? viewtopic.php?f=91&t=60974 Link to comment
ice_brasil Posted June 19, 2013 Author Share Posted June 19, 2013 Well as I said I never used and do not know how most tried this: local lastTick = 0 local toWait = 60000 addEventHandler ( "onClientGUIClick", guiRoot, function ( ) if ( source == GUIEditor.button[2] ) then end if ( getTickCount ( ) - lastTick >= toWait ) then lastTick = getTickCount ( ) else outputChatBox ( "You must wait 60 seconds to use it again!", 255, 0, 0 ) end end end ) I want to put to use can only GUIEditor.button [2] every 1 minute What did this wrong? Link to comment
iPrestege Posted June 19, 2013 Share Posted June 19, 2013 You just mix castillo code with your . This isn't good. Link to comment
xXMADEXx Posted June 19, 2013 Share Posted June 19, 2013 addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[2] ) then local car = getPedOccupiedVehicle ( localPlayer ) if ( car ) then fixVehicle ( car ) guiSetEnabled ( source, false ) setTimer ( function ( element ) guiSetEnabled ( element, true ) end, 60000, 1, source ) end end end ) Link to comment
xXMADEXx Posted June 19, 2013 Share Posted June 19, 2013 Madex have skype ? Look at my signature... 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