• 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 Script not working

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
665
Hello.
My script not working
LUA:
local left = {x=750, y=708, z=7}
local right = {x=751, y=708, z=7}
 
local summon = {x=750, y=707, z=7}
 
local from = {x=747, y=706, z=7} -- top left corner
local to = {x=758, y=723, z=7} -- bottom right corner
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(left)
		if a.itemid == 12412 and a.type >= 1 then
			local b = getThingfromPos(right)
			if b.itemid == 8614 and b.type >= 3 then
				for x = from.x, to.x do
					for y = from.y, to.y do
						local f = getTopCreature({x=x, y=y, z=from.z}).uid
						if f ~= 0 and isMonster(f) and getCreatureMaster(f) == f and getCreatureName(f):lower() == 'triceratops' then
							return doPlayerSendCancel(cid, 'There is already monster.') 
						end
					end
				end
				doRemoveItem(a.uid, 2)
				doRemoveItem(b.uid, 2)
				doCreateMonster('Triceratops', summon)
				doCreateMonster('Triceratops', summon)
				doSendMagicEffect(summon, 64)
				return doTransformItem(item.uid, 1946)
			end
		end
		return doPlayerSendCancel(cid, 'You need one triceratops skin and three tusks to use that lever.') and doSendMagicEffect(getCreaturePosition(cid), 2)
	end
	return doTransformItem(item.uid, 1945)
end

If it's items on right and left position script is still not working ;/

Anyone can fix it, what's wrong with this script ?

- - - Updated - - -

bumpy dumpy
 
try this:
LUA:
local left = {x=750, y=708, z=7},
local right = {x=751, y=708, z=7}, 
local summon = {x=750, y=707, z=7}, 
local from = {x=747, y=706, z=7},
local to = {x=758, y=723, z=7
} 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(left)
		if a.itemid == 12412 and a.type >= 1 then
			local b = getThingfromPos(right)
			if b.itemid == 8614 and b.type >= 3 then
				for x = from.x, to.x do
					for y = from.y, to.y do
						local f = getTopCreature({x=x, y=y, z=from.z}).uid
						if f ~= 0 and isMonster(f) and getCreatureMaster(f) == f and getCreatureName(f):lower() == 'triceratops' then
							return doPlayerSendCancel(cid, 'There is already monster.') 
						end
					end
				end
				doRemoveItem(a.uid, 2)
				doRemoveItem(b.uid, 2)
				doCreateMonster('Triceratops', summon)
				doCreateMonster('Triceratops', summon)
				doSendMagicEffect(summon, 64)
				return doTransformItem(item.uid, 1946)
			end
		end
		return doPlayerSendCancel(cid, 'You need one triceratops skin and three tusks to use that lever.') and doSendMagicEffect(getCreaturePosition(cid), 2)
	end
	return doTransformItem(item.uid, 1945)
end
 
Back
Top