• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Kill monster and teleporting

LUA:
local positions = { -- Enter tiles here
	{x=1349, y=826, z=13},
	{x=1350, y=826, z=13},
}

local cfg = {
	teleto = {x= 1,y= 1,z= 1}, -- put position to teleport to
	monster = 'MONSTER NAME', -- put monster name here in lowercase 
}


function isPositionInArray(haystack, needle)
	for i = 1, #haystack do
		if haystack[i].x == needle.x and haystack[i].y == needle.y and haystack[i].z == needle.z then
			return true
		end
	end
end

function onKill(cid, target, flags)
	if getCreatureName(target):lower() == cfg.monster then
		local myPos = getThingPos(cid)
		if isPositionInArray(positions, myPos) then
			doTeleportThing(cid, cfg.teleto)
		end
	end
	return true
end
Credits to cykotitan.

+REP if I helped you
 
He doesn't need all of that.
Code:
local t = {
	teleportTo = {x=1,y=1,z=1},
	monsterName = 'MONSTER NAME'
}
function onKill(cid, target, flags)
	if getCreatureName(target):lower() == t.monsterName:lower() then
		doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		doTeleportThing(cid, t.teleportTo)
		doSendMagicEffect(t.teleportTo, CONST_ME_TELEPORT)
	end
	return true
end
 
Back
Top