SoiiNoob Posted May 22, 2012 Share Posted May 22, 2012 It works getTickCount or setTimer ? really i want a timer showing like: in 4:00:00 hours it will start the resource zombies and when it reaches to 0:00:00 start some like: function iniciar startResource ( zombies ) outputChatBox ("La horda de zombies ha comenzado!") end setTimer (iniciar,576000000,1) -- 576000000 = 4 real hours function detener stopResource ( zombies ) outputChatBox ("La horda se ha detenido!") end setTimer (detener,144000000,1) -- 144000000 = 1 real hour but with a counter showing up like this: http://img152.imageshack.us/img152/8029/gtasa2012052123441175.png Link to comment
Kenix Posted May 22, 2012 Share Posted May 22, 2012 you should use getResourceFromName instead of variable zombies and check resource (loaded/running). local pZombieResource = getResourceFromName 'zombies' setTimer( function( ) local nHour = getTime( ) -- get hour if nHour == 0 then if getResourceState( pZombieResource ) == 'loaded' then -- check startResource( pZombieResource ) -- start resource outputChatBox 'La horda de zombies ha comenzado!' end elseif nHour == 4 then if getResourceState( pZombieResource ) == 'running' then -- check stopResource( pZombieResource ) -- stop resource outputChatBox 'La horda se ha detenido!' end end end, 1000, 0 ) Don't forget add rights for this resource. Link to comment
Stanley Sathler Posted May 22, 2012 Share Posted May 22, 2012 local pZombieResource = getResourceFromName 'zombies' setTimer( function( ) local nHour = getTime( ) -- get hour if (nHour >= 0 and nHour <= 4) then if getResourceState( pZombieResource ) == 'loaded' then -- check startResource( pZombieResource ) -- start resource outputChatBox 'La horda de zombies ha comenzado!' end elseif nHour >= 4 then if getResourceState( pZombieResource ) == 'running' then -- check stopResource( pZombieResource ) -- stop resource outputChatBox 'La horda se ha detenido!' end end end, 1000, 0 ) - Try it. Is the Kenix example, but I modified the nHour condition. - I don't know if is it what you want, but between 0:00 and 4:00am, the zombie resource will be started. 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