Guest User

checkmount.lua

a guest
Dec 26th, 2013
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Aluguel_mounts = {
  2.     ["brown war horse"] = {price = 10000, days = 2, mountid = 17, level = 10, premium = false, storage = 50561},
  3.     ["fire war horse"] = {price = 30000, days = 1, mountid = 23, level = 20, premium = false, storage = 50562},
  4.     ["king scorpion"] = {price = 50000, days = 1, mountid = 21, level = 30, premium = false, storage = 50563}
  5. }
  6.  
  7. local function doRemovePlayerMount(cid, mountId) -- vodka
  8.     doPlayerRemoveMount(cid, mountId)
  9.     return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})
  10. end
  11.  
  12. local function CheckRentMount(cid)
  13.     for var, ret in pairs(Aluguel_mounts) do
  14.         if getPlayerMount(cid, ret.mountid) and getPlayerStorageValue(cid, ret.storage) ~= -1 and getPlayerStorageValue(cid, ret.storage) <= os.time() then
  15.             doRemovePlayerMount(cid, ret.mountid)
  16.             doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The time of your mount " .. var .. " has ended, to get it again back to the NPC.")
  17.         end
  18.     end
  19. end
  20.  
  21. function onThink(interval)
  22.     for _, cid in ipairs(getOnlinePlayers()) do
  23.         CheckRentMount(cid)
  24.     end
  25.     return true
  26. end
RAW Paste Data