Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Hunting room by Ukzz&Rer #--
- HUNTINGROOMS_CREATURE_TIMELEFT = 5123
- HUNTINGROOMS_RESPAWN_EXHAUST = 10
- HUNTINGROOMS_TOKEN_ITEMID = 2311
- DEFAULT_EXHAUSTION_STORAGE = 41231
- HUNTINGROOMS = {
- [11001] = {
- name = "Nazwa rooma",
- monster = "Demon",
- cost = 1,
- time = 900,
- _player = nil
- }
- }
- function checkExhausted(cid, storage, val)
- if(not exhaustion.check(cid, storage)) then
- exhaustion.set(cid, storage, val)
- return true
- else
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- doPlayerSendCancel(cid, "You are exhausted.")
- return false
- end
- end
- --# Hunting room by Ukzz&Rer #--
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- if(not(HUNTINGROOMS[item.actionid] and checkExhausted(cid, DEFAULT_EXHAUSTION_STORAGE, 2))) then
- return true
- end
- local obj = HUNTINGROOMS[item.actionid]
- if(obj._player ~= nil) then
- local timeleft = getPlayerStorageValue(_player, HUNTINGROOMS_CREATURE_TIMELEFT) - os.time()
- return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Sorry, room is occupied for " .. timeleft .. " seconds more.")
- end
- if(doPlayerRemoveItem(cid, HUNTINGROOMS_TOKEN_ITEMID, obj.cost) ~= true) then
- return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Sorry, you don't have " .. obj.cost .. " token/s to enter.")
- end
- doTeleportThing(cid, {x = fromPosition.x, y = fromPosition.y - 5, z = fromPosition.z})
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You enter to " .. obj.name .. " hunting room.")
- setPlayerStorageValue(cid, HUNTINGROOMS_CREATURE_TIMELEFT, os.time()+obj.time)
- obj._player = cid
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement