Jump to content

help


Paplo

Recommended Posts

  
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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...