Paplo Posted June 18, 2013 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?
Castillo Posted June 18, 2013 Posted June 18, 2013 You can use a timer ( not efficient ) or you can use getTickCount. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Paplo Posted June 18, 2013 Author Posted June 18, 2013 You can use a timer ( not efficient ) or you can use getTickCount. can you give me example ?
Castillo Posted June 18, 2013 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Paplo Posted June 18, 2013 Author 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
Castillo Posted June 18, 2013 Posted June 18, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Paplo Posted June 19, 2013 Author Posted June 19, 2013 Solidsnake14 i want the all player wait 60 sc if any player bought how i can do that?
iMr.3a[Z]eF Posted June 19, 2013 Posted June 19, 2013 did we gived the code for you before? To Visit Us Press Here: mtasa://5.9.206.180:22002
Paplo Posted June 19, 2013 Author Posted June 19, 2013 did we gived the code for you before? yes but you'r code Not compatible with my code solidsnake14 know ^^
Castillo Posted June 19, 2013 Posted June 19, 2013 You want it global? then you must move the check server side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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