function onKill(cid, target)
local m = {
["Ghazbaran"] = {
message = "Escape through the teleport quickly before it closes!",
cfg = {
{
time = 10, -- Seconds until tp closes.
to = { x = xxx, y = xxx, z = xxx }, -- Where the tp takes you.
tp = { x = xxx, y = xxx, z = xxx } -- Where the tp creates.
},
}
}
}
if isPlayer(target) then
return true
end
local monster = m[getCreatureName(target)]
if monster then
for i = 1, #monster.cfg do
local c = monster.cfg
local function deleteTeleport()
local teleport = getTileItemById(c.tp, 1387).uid
if(teleport > 0) then
doRemoveItem(teleport)
doSendMagicEffect(c.tp, CONST_ME_POFF)
end
return true
end
doCreateTeleport(1387, c.to, c.tp)
doSendMagicEffect(c.tp, CONST_ME_ENERGYAREA)
addEvent(deleteTeleport, c.time * 1000) end
doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1)
end
return true
end
<event type="kill" name="MonsterPortal" event="script" value="dead.lua"/>
local m,p = 'Creaturename',{x=1,y=1,z=7} -- creaturename of monster & teleport destination.
function onKill(cid,target)
local v = getThingPos(cid)
if getCreatureName(target:lower()) == m:lower() then
doTeleportThing(cid,p)
doSendMagicEffect(v,CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You killed '..m..' and got teleported.')
end
return true
end
local t = {
[6001] = {8001,"magic sword",2400},
[6002] = {8001,"demon armor",2494},
[6003] = {8001,"stonecutter axe",2431},
[6004] = {8001,"annihilation bear",2326}
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = t[item.uid]
if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
setPlayerStorageValue(cid,v[1],1)
doPlayerAddItem(cid,v[3])
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
elseif getPlayerStorageValue(cid,v[1]) == 1 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
end
return true
end
<action uniqueid="6001-6004" event="script" value="annihichests.lua"/>