Sr.Taco
Member
- Joined
- Jul 9, 2015
- Messages
- 21
- Reaction score
- 8
Hi, I have this script working, that gives reward, random and every x time
but I wanted to open it to create the illusion that you are looking for something
an example is this
the script I use is this
sorry for my bad English
but I wanted to open it to create the illusion that you are looking for something
an example is this
the script I use is this
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local waitTime = 1*60 --
local storage = 123456 --
local t = {
{ item = 2140, count = 1 },
{ item = 2121, count = 1 },
{ item = 2152, count = 1 },
{ item = 2143, count = 1 },
{ item = 2237, count = 1 }
}
local posicion = {x = 1015, y = 1032, z = 8} -- Posicion a donde sera teletransportado
--! Nabs don't configure !--
local queststatus = getPlayerStorageValue(cid,storage)
if queststatus + (waitTime) <= os.time() then
setPlayerStorageValue(cid,storage,os.time())
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"reward chest entregada.")
local random = math.random(1, #t)
doPlayerAddItem(cid, t[random].item, t[random].count)
doTeleportThing(cid, posicion)
doSendMagicEffect(posicion, 10)
elseif getPlayerStorageValue(cid, storage)-os.time()+(waitTime) <= 60 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"It is empty, come back in ".. getPlayerStorageValue(cid, storage)-os.time()+(waitTime) .." seconds.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"It is empty, come back in ".. timeString(getPlayerStorageValue(cid, storage)-os.time()+(waitTime)) ..".")
end
return true
end
function timeString(timeDiff)
local dateFormat = {
{"day", timeDiff / 60 / 60 / 24},
{"hour", timeDiff / 60 / 60 % 24},
{"minute", timeDiff / 60 % 60},
{"second", timeDiff % 60}
}
local out = {}
for k, t in ipairs(dateFormat) do
local v = math.floor(t[2])
if(v > 0) then
table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
end
end
return table.concat(out)
end
Code:
<action uniqueid="xxxx" event="script" value="rewardchest.lua" />
sorry for my bad English
Last edited: