samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 447
- Solutions
- 3
- Reaction score
- 49
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
Need Script x item 8981 acess area 30 minutes with contdown movemente I already did it even logging out in the middle of time, go to the temple
Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 150, y = 50, z = 7}
local timeInterval = 30 * 60
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid, storageValue) ~= -1 then
doPlayerSendCancel(cid, "Voce ja tem acesso a essa funcionalidade.")
return true
end
if not doPlayerRemoveItem(cid, itemID, 1) then
doPlayerSendCancel(cid, "Voce precisa ter o item no set ou na bp para usar essa funcionalidade e de (use).")
return true
end
local currentTime = os.time()
local accessTime = 72 * 60 * 60
local expirationTime = currentTime + accessTime
setPlayerStorageValue(cid, storageValue, expirationTime)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Ganhou Acesso a Cave Exclusiva Por 72 Horas Bom [LEVEL-UP].")
return true
end
function onLogin(cid)
local currentTime = os.time()
local expirationTime = getPlayerStorageValue(cid, storageValue)
if expirationTime ~= -1 and currentTime >= expirationTime then
doTeleportThing(cid, teleportPosition, false)
setPlayerStorageValue(cid, storageValue, -1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para a posição 154, 51, 7.")
end
local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck")
if timeDifference >= timeInterval then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O tempo atual é: " .. os.date("%H:%M:%S"))
setPlayerStorageValue(cid, "lastTimeCheck", currentTime)
end
return true
end