Jump to content

Timer Problem


Wei

Recommended Posts

waitTimer = {} 
  
function playerChat(message, messageType) 
    if messageType == 0 then 
    cancelEvent() 
        if waitTimer[source] then return exports["[PG]dxBox"]:dxOutput(source,"You must wait 5 seconds between every message!", 255, 0, 0) end 
            if not isGuestAccount(getPlayerAccount(source)) then 
                if hasObjectPermissionTo ( source, "function.kickPlayer", false ) then 
                    outputChatBox(getPlayerName(source).."[A]: #FFFFFF"..message, root, 200, 200, 200, true ) 
                    outputServerLog("CHAT: "..getPlayerName(source)..": "..message) 
                else 
                    outputChatBox(getPlayerName(source)..": #FFFFFF"..message, root, 255, 255, 255, true ) 
                    outputServerLog("CHAT: "..getPlayerName(source)..": "..message) 
                    waitTimer[source] = setTimer( function() end, 5000, 1 ) 
                end 
            else 
            exports["[PG]dxBox"]:dxOutput(source,"You must be logged in to type in chatbox!", 255, 0, 0) 
            end 
    end 
end 
addEventHandler("onPlayerChat", root, playerChat) 

After 5 sec it still saying you must wait 5 sec between every message....

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