Ir para conteúdo

Ruyzin Pikatxufly

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Curtir
    <action itemid="8981" script="access.lua"/> local storageValue = 13741 local itemID = 8981 -- Item utilizado para conceder o acesso de 72 horas local teleportPosition = {x = 154, y = 51, z = 7} -- Posição de teleporte quando o tempo acabar local timeInterval = 1 * 60 -- Intervalo de tempo em segundos (30 minutos) function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, storageValue) ~= -1 then doPlayerSendCancel(cid, "Você já tem acesso a essa funcionalidade.") return true end if not doPlayerRemoveItem(cid, itemID, 1) then doPlayerSendCancel(cid, "Você precisa ter o item necessário para usar essa funcionalidade.") return true end local currentTime = os.time() local accessTime = 72 * 60 * 60 -- Convertendo 72 horas para segundos local expirationTime = currentTime + accessTime setPlayerStorageValue(cid, storageValue, expirationTime) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso a essa funcionalidade por 72 horas.") 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 local timeRemaining = expirationTime - currentTime local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 local timeString = string.format("%02d:%02d:%02d", hours, minutes, seconds) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tempo restante: " .. timeString) setPlayerStorageValue(cid, "lastTimeCheck", currentTime) end return true end <movevent type="StepIn" uniqueid="18956" event="script" value="acessoTile.lua"/> function onStepIn(cid, item, position, fromPosition) local sto = 13741 -- storage Aqui if isPlayer(cid) then if getPlayerStorageValue(cid, sto) >= 1 then doPlayerSendTextMessage(cid, 25, "Seja bem vindo a area.") else doTeleportThing(cid, fromPosition, true) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, 25, "Você Não Tem Acesso!") end end return true end  
  2. Obrigado
    Ruyzin Pikatxufly recebeu reputação de Doidodepeda em Cooldown em items (USE) actions   
    local cooldown = 60 -- Cooldown em segundos function onUse(cid, item, frompos, item2, topos) local lastUseTime = getPlayerStorageValue(cid, 12345) local currentTime = os.time() if lastUseTime == -1 or currentTime - lastUseTime >= cooldown then doPlayerSetStamina(cid, 2520) doCreatureSay(cid, 'Stamina Full', TALKTYPE_ORANGE_1) doSendMagicEffect(frompos, 1) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, 12345, currentTime) addEvent(function() setPlayerStorageValue(cid, 12345, -1) end, cooldown * 1000) else local remainingTime = cooldown - (currentTime - lastUseTime) local minutes = math.floor(remainingTime / 60) local seconds = remainingTime % 60 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must wait " .. minutes .. " minutes and " .. seconds .. " seconds before using this again.") end return true end Tenta Essa Ai!!

Informação Importante

Confirmação de Termo