• 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!

Lua checking for dead bodies

WSouls

New Member
Joined
Aug 5, 2010
Messages
51
Reaction score
1
Code:
function onStepIn(cid, item, position, fromPosition)
	getbody1 = getThingfromPos({x = position.x+1, y = position.y, z = position.z, stackpos = 1})
	getbody2 = getThingfromPos({x = position.x-1, y = position.y, z = position.z, stackpos = 1})
	if (getbody1.itemid == 3065 or getbody1.itemid == 3058 and getbody2.itemid == 3065 or getbody1.itemid == 3058) then
		if (doRemoveItem(getbody1.uid, 1) == LUA_NO_ERROR and doRemoveItem(getbody2.uid, 1) == LUA_NO_ERROR) then
			doTeleportThing(cid, {x = 331, y = 495, z = 10}, FALSE)
			doCreatureAddHealth(cid, -getCreatureMaxHealth(cid)*0.33)
			doSendMagicEffect(position, 2)
		end
	else
		doPlayerSendCancel(cid,"Nothing has been offered to pass the barrier.")
	end
    return true
end
when u step on a tile it checks for dead human bodies 1st moveable stage male or female. it checks one pos left and one pos right of the tile ur stepping on.
 
try this:

LUA:
function onStepIn(cid,item,position,fromPosition)
local getbody1,getbody2 = getThingfromPos({x = position.x+1, y = position.y, z = position.z, stackpos = 1}),getThingfromPos({x = position.x-1, y = position.y, z = position.z, stackpos = 1})
	if getbody1.itemid ~= nil and getbody2.itemid ~= nil then
		if getbody1.itemid == 3065 or getbody1.itemid == 3058 and getbody2.itemid == 3065 or getbody2.itemid == 3058 then
			if doRemoveItem(getbody1.uid,1) and doRemoveItem(getbody2.uid,1) then
				doTeleportThing(cid,p,false)
				doCreatureAddHealth(cid,getCreatureHealth(cid)-getCreatureMaxHealth(cid)*0.33)
				doSendMagicEffect(position,CONST_ME_POFF)
			end
		else
			doPlayerSendCancel(cid,"Nothing has been offered to pass the barrier.")
		end
	else
		doPlayerSendCancel(cid,RETURNVALUE_NOTPOSSIBLE)
	end
	return true
end
 
LUA:
function onStepIn(cid, item, pos, fromPosition)
	pos.stackpos = 1
	local a, b = getThingfromPos({x=pos.x+1, y=pos.y, z=pos.z}), getThingfromPos({x=pos.x-1, y=pos.y, z=pos.z})
	if table.find({3058, 3065}, a.itemid) and table.find({3058, 3065}, b.itemid) then
		doRemoveItem(a.uid)
		doRemoveItem(b.uid)
		doTeleportThing(cid, {x=331, y=495, z=10})
		doCreatureAddHealth(cid, -getCreatureMaxHealth(cid)*0.33)
		doSendMagicEffect(pos, 2)
	else
		doPlayerSendCancel(cid, "Nothing has been offered to pass the barrier.")
	end
	return true
end
 
Back
Top