Jump to content

Fix a code.


WiBox

Recommended Posts

local Time1 = 3600000
function event () 
    function timer()
        setTimer(
            function()
                if Time1 >= 0 then
                    Time1 = Time1 -3000 
                        for _,all in ipairs ( localPlayer ) do
                            outputChatBox("The event will start every one hour once. TimeLeft:"..Time1.." miliseconds(1000 = 1 second).", all, 0, 255, 0)
                        end
                        timer()
                end
            end, 600000, 0 )
    end
end
addEventHandler("onResourceStart", root, timer )  

Please? can someone fix it? I already tried using in console " debugscript 3 " fixed all bugs but still not working.. any help? I just need to fix this code, and if I made it wrong, from this code I  need that each 10 minutes message will be send for all players that the event will start each 1 hour, each 10 minutes i want the message get send and first time said {50 minutes left... 40 minutes left... 30 minutes lefts... 20 minutes left... 10 minutes left.... 0 minutes left...} i want those minutes on ..Time1..  place each 10 minutes it will say how much left... I appreciate for who help me. Even if he at least try to ^_^

Link to comment

 :lol:  :lol:  :lol:  :lol:  :lol:  :sad:  :sad:  :sad:  :sad:  :sad:

Try this out. May be it'll good.


function event () 
  local Time1 = 50
    for _,all in ipairs ( getElementsByType("player") ) do
        outputChatBox( "Event Will Started In 60 Minutes. #ff0000TimeLeft:- #00ff0060 Minutes", all, 255, 255, 0, true )
	end
    eventTimer = setTimer(
    function()
	    if Time1 > 0 then
            for _,all in ipairs ( getElementsByType("player") ) do
                outputChatBox("The event will start every one hour once. TimeLeft: "..Time1.." Minutes", all, 0, 255, 0)
	        end
			Time1 = Time1 - 10
		else
		    for _,all in ipairs ( getElementsByType("player") ) do
		        outputChatBox("Event Started !", all, 255, 255, 0)
			end
		    killTimer(eventTimer)
		end
    end, 600000, 0 )
end

addEventHandler("onResourceStart",resourceRoot,event)

 

  • Haha 1
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...