Date:
07.08.2015 - 14:58:30
Author:
Rewrite:
Type here:
-- Dice Arena Event criado por Killua, XTibia.com local function getMonsterCategory(name) for index, names in pairs(dice_cfg.numbers) do if isInArray(names, ""..name.."") then return index end end end function onKill(cid, target, lastHit) if isMonster(target) and isPlayer(cid) then if isInArea(getThingPos(target), dice_cfg.arena_frompos, dice_cfg.arena_topos) then if getGlobalStorageValue(8181818) <= os.time() then setGlobalStorageValue(8181818, os.time() + 1) if getMonsterCategory(getCreatureName(target)) then if getMonsterCategory(getCreatureName(target)) > 2 then addEvent(doCreateItem, 200, dice_cfg.noob_item[1], math.random(1, dice_cfg.noob_item[2]), getThingPos(target)) elseif getMonsterCategory(getCreatureName(target)) == 2 then local chance = math.random(1,100) if chance <= 20 then addEvent(doCreateItem, 200, dice_cfg.pro_item[1], math.random(1, dice_cfg.pro_item[2]), getThingPos(target)) else addEvent(doCreateItem, 200, dice_cfg.noob_item[1], math.random(1, dice_cfg.noob_item[2]), getThingPos(target)) end elseif getMonsterCategory(getCreatureName(target)) == 1 then addEvent(doCreateItem, 200, dice_cfg.pro_item[1], math.random(1, dice_cfg.pro_item[2]), getThingPos(target)) end doSendMagicEffect(getThingPos(target), 38) doCreatureSay(target, "You have gained a special loot!", TALKTYPE_ORANGE_1) end end end end return true end function onLogin(cid) if isInArea(getThingPos(cid), dice_cfg.arena_frompos, dice_cfg.arena_topos) then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end registerCreatureEvent(cid, "diceKill") return true end