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

dead bodies and lever

Magictibiaman

New Member
Joined
May 25, 2009
Messages
371
Reaction score
0
i'm creating a quest

after the person kills the mosnters i want them to place it on a pedestal or square. how do i make so that when they use the lever it checks if there is the right dead body and then remove the body
 
this is what i constructed the only problem i have is
that it keeps saying "Success" even when it is not the right item, or even if there is nothing there
Code:
function onUse(cid, item, frompos, item2, topos)
	itempos1 = {x= 864, y=627, z=6, stackpos=1}
	deadbody1 = 6516
	

	local item1 = getTileItemById(itempos1,deadbody1 )

	if (item1) then
   	 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Success." )
	else
 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Fail.")

	end


	return 1
end
 
Code:
local cfg = {
	pos = {x= 864, y=627, z=6},
	itemid = 6516
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local thing = getTileItemById(cfg.pos, cfg.itemid).uid
	if(thing > 0) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Success.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Fail.")
	end
	return TRUE
end
Shorter
Code:
local cfg = {
	pos = {x= 864, y=627, z=6},
	itemid = 6516
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return TRUE, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getTileItemById(cfg.pos, cfg.itemid).uid > 0 and "Success." or "Fail.")
end
 
Back
Top