Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add this in lib 05 function
- function secondsToClock(sSeconds)
- local nSeconds = tonumber(sSeconds)
- if nSeconds == 0 then
- return "00:00:00"
- else
- local nHours = string.format("%02.f", math.floor(nSeconds / 3600))
- local nMins = string.format("%02.f", math.floor(nSeconds / 60 - (nHours * 60)))
- local nSecs = string.format("%02.f", math.floor(nSeconds - nHours * 3600 - nMins * 60))
- return nHours..":"..nMins..":"..nSecs
- end
- end
- this the script
- local noob_item = {
- 2280,
- 2278,
- 2263,
- 2275,
- 2646,
- 2272,
- 2160
- }
- local storage = 44795100
- local cash = {
- min = 10,
- max = 100
- }
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- local noob = noob_item[math.random(1, #noob_item)]
- if getPlayerLevel(cid) >= 200 then
- if getCreatureStorage(cid, storage) <= os.time() then
- local cash = math.random(cash.min, cash.max)
- doPlayerAddItem(cid, 2160, cash)
- doPlayerAddItem(cid,noob,1)
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You get ' .. cash .. ' crystal coins and '..getItemNameById(noob)..' from your king!')
- doCreatureSetStorage(cid, storage, os.time() + 60 * 60 * 24)
- else
- doPlayerSendCancel(cid, 'You have already get your gift! You can get it again in ' .. secondsToClock(math.abs(os.difftime(getCreatureStorage(cid, storage), os.time()))) .. '.')
- end
- else
- doPlayerSendCancel(cid, 'Your level is to low. You should have level 200.')
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement