Paplo Posted June 18, 2013 Share Posted June 18, 2013 client Group = { {100000}, } addEventHandler("onClientGUIClick", guiRoot, function() if source == GUIEditor.staticimage[2] then local money = 0 if source == GUIEditor.staticimage[2] then money = Group[1][1] end if getPlayerMoney(localPlayer) >= tonumber ( money ) then triggerServerEvent('sound1',money) sound = playSound("1.mp3", false) else outputChatBox(' You Not Have Money', 255, 0, 0) end end end ) Server addEvent("sound1", true) addEventHandler("sound1",getRootElement(), function(money) takePlayerMoney(source, tonumber( money ) ) end ) I need to make if the player click in the picture twice quickly then Server that tells him to wait 60 seconds How can I do this? Link to comment
Castillo Posted June 18, 2013 Share Posted June 18, 2013 You can use a timer ( not efficient ) or you can use getTickCount. Link to comment
Paplo Posted June 18, 2013 Author Share Posted June 18, 2013 You can use a timer ( not efficient ) or you can use getTickCount. can you give me example ? Link to comment
Castillo Posted June 18, 2013 Share Posted June 18, 2013 local lastTick = 0 -- Define a variable with the last tick count local toWait = 60000 -- Define a variable with the time needed to wait local Group = { { 100000 }, } addEventHandler ( "onClientGUIClick", guiRoot, function ( ) if ( source == GUIEditor.staticimage[2] ) then local money = 0 if ( source == GUIEditor.staticimage[2] ) then money = Group[1][1] end if ( getTickCount ( ) - lastTick >= toWait ) then -- Calculate how long it passed since last used and compare with required time to wait. if ( getPlayerMoney ( ) >= tonumber ( money ) ) then triggerServerEvent ( 'sound1', money ) sound = playSound ( "1.mp3", false ) lastTick = getTickCount ( ) else outputChatBox ( 'You Not Have Money', 255, 0, 0 ) end else outputChatBox ( "You must wait 60 seconds to use it again!", 255, 0, 0 ) end end end ) Link to comment
Paplo Posted June 18, 2013 Author Share Posted June 18, 2013 local lastTick = 0 -- Define a variable with the last tick count local toWait = 60000 -- Define a variable with the time needed to wait local Group = { { 100000 }, } addEventHandler ( "onClientGUIClick", guiRoot, function ( ) if ( source == GUIEditor.staticimage[2] ) then local money = 0 if ( source == GUIEditor.staticimage[2] ) then money = Group[1][1] end if ( getTickCount ( ) - lastTick >= toWait ) then -- Calculate how long it passed since last used and compare with required time to wait. if ( getPlayerMoney ( ) >= tonumber ( money ) ) then triggerServerEvent ( 'sound1', money ) sound = playSound ( "1.mp3", false ) lastTick = getTickCount ( ) else outputChatBox ( 'You Not Have Money', 255, 0, 0 ) end else outputChatBox ( "You must wait 60 seconds to use it again!", 255, 0, 0 ) end end end ) Thank you I'm very grateful to you Have helped me Link to comment
Paplo Posted June 19, 2013 Author Share Posted June 19, 2013 Solidsnake14 i want the all player wait 60 sc if any player bought how i can do that? Link to comment
iMr.3a[Z]eF Posted June 19, 2013 Share Posted June 19, 2013 did we gived the code for you before? Link to comment
Paplo Posted June 19, 2013 Author Share Posted June 19, 2013 did we gived the code for you before? yes but you'r code Not compatible with my code solidsnake14 know ^^ Link to comment
Castillo Posted June 19, 2013 Share Posted June 19, 2013 You want it global? then you must move the check server side. 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