local function EventOnline(playerId, seconds)
local Ticks = 1000 -- Function will execute every seconds (1000 = 1 second)
local player = Player(playerId)
if seconds > 0 and player and player:getStorageValue(59000) == 1 then
-- Stuff for execute every tick
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Pam~! Pam~! Pam~!")
addEvent(EventOnline, Ticks, playerId, seconds - 1)
end
return true
end
local StatusTime = 58000 -- Storage number for check active or not
local WorkingTime = 60 -- in seconds, event will work for 60 seconds
local Activator = 59000 -- This will for manually On/Off
function onUse(player, item, fromPosition, itemEx, toPosition)
if player:getStorageValue(StatusTime) <= os.time() and player:getStorageValue(Activator) <= 0 then
player:setStorageValue(StatusTime, os.time() + (WorkingTime - 1))
player:setStorageValue(Activator, 1)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Ascuas The God xD")
return EventOnline(player:getId(), WorkingTime)
end
-- if use item second time will stop event immediately
player:setStorageValue(StatusTime, os.time())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "What are you doing, bastard!")
player:setStorageValue(Activator, 0)
return
end