Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. add this in lib 05 function
  2. function secondsToClock(sSeconds)
  3. local nSeconds = tonumber(sSeconds)
  4. if nSeconds == 0 then
  5. return "00:00:00"
  6. else
  7. local nHours = string.format("%02.f", math.floor(nSeconds / 3600))
  8. local nMins = string.format("%02.f", math.floor(nSeconds / 60 - (nHours * 60)))
  9. local nSecs = string.format("%02.f", math.floor(nSeconds - nHours * 3600 - nMins * 60))
  10.  
  11. return nHours..":"..nMins..":"..nSecs
  12. end
  13. end
  14.  
  15.  
  16.  
  17. this the script
  18.  
  19.  
  20. local noob_item = {
  21. 2280,
  22. 2278,
  23. 2263,
  24. 2275,
  25. 2646,
  26. 2272,
  27. 2160
  28. }
  29. local storage = 44795100
  30. local cash = {
  31. min = 10,
  32. max = 100
  33. }
  34. function onUse(cid, item, fromPosition, itemEx, toPosition)
  35. local noob = noob_item[math.random(1, #noob_item)]
  36. if getPlayerLevel(cid) >= 200 then
  37. if getCreatureStorage(cid, storage) <= os.time() then
  38. local cash = math.random(cash.min, cash.max)
  39. doPlayerAddItem(cid, 2160, cash)
  40. doPlayerAddItem(cid,noob,1)
  41. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You get ' .. cash .. ' crystal coins and '..getItemNameById(noob)..' from your king!')
  42. doCreatureSetStorage(cid, storage, os.time() + 60 * 60 * 24)
  43. else
  44. doPlayerSendCancel(cid, 'You have already get your gift! You can get it again in ' .. secondsToClock(math.abs(os.difftime(getCreatureStorage(cid, storage), os.time()))) .. '.')
  45. end
  46. else
  47. doPlayerSendCancel(cid, 'Your level is to low. You should have level 200.')
  48. end
  49. return true
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement