• 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 Can Somebody Try Fix It?

Erikas Kontenis

Excellent OT User
Joined
Jul 3, 2009
Messages
1,936
Reaction score
680
Location
Lithuania
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local gatePosition = {x=1107, y=846, z=7, stackpos=1}
	local getGate = getThingFromPos(gatePosition)
	if(item.uid == 5005) then
		if(item.itemid == 1945 and getGate.itemid == 1546) then
			doRemoveItem(getGate.uid, 1)
			doTransformItem(item.uid, item.itemid+1)
			addEvent(onTimer4, 1*60*1000)
		elseif(item.itemid == 1946 and getGate.itemid == 0) then
			doTransformItem(item.uid, item.itemid-1)
			doCreateItem(1546, 1, gatePosition)
		else
			doPlayerSendCancel(cid, "Sorry not possible.")
		end
	end
	return 1
end

function onTimer4()

wallnewpos = {x=1107, y=846, z=7}  		
		doCreateItem(1546,1,wallnewpos)
end

Can Someone Can Just Try TO Fix it? Its a easy script i know but im just learning a lua :) its tfs 0.3.5 Everything works fine, but then 1 mins take's off a switch not regain... :( can somebody help me with this?
 
LUA:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        local gatePosition = {x=1107, y=846, z=7, stackpos=1}
        local getGate = getThingFromPos(gatePosition)
        if(item.uid == 5005) then
                if(item.itemid == 1945 and getGate.itemid == 1546) then
                        doRemoveItem(getGate.uid, 1)
                        addEvent(onTimer4, 1*60*1000)
                else
                        doPlayerSendCancel(cid, "Sorry not possible.")
                end
        end
        return 1
end

function onTimer4()

wallnewpos = {x=1107, y=846, z=7}              
                doCreateItem(1546,1,wallnewpos)
end
this will work
 
LUA:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        local gatePosition = {x=1107, y=846, z=7, stackpos=1}
        local getGate = getThingFromPos(gatePosition)
        if(item.uid == 5005) then
                if(item.itemid == 1945 and getGate.itemid == 1546) then
                        doRemoveItem(getGate.uid, 1)
                        addEvent(onTimer4, 1*60*1000)
                else
                        doPlayerSendCancel(cid, "Sorry not possible.")
                end
        end
        return 1
end

function onTimer4()

wallnewpos = {x=1107, y=846, z=7}              
                doCreateItem(1546,1,wallnewpos)
end
this will work

Not Exactly what i need... but thanks rep for u !
 
Code:
doSendMagicEffect(pos,54)
pos = {x=0, y=0, z=0}
like this
LUA:
function onUse(cid, item, frompos, item2, topos)
doSendMagicEffect(item,54)
end
 
Code:
doSendMagicEffect(pos,54)
pos = {x=0, y=0, z=0}
like this
LUA:
function onUse(cid, item, frompos, item2, topos)
doSendMagicEffect(item,54)
end


I maked in other way :P Its a bit easer :P

LUA:
doSendMagicEffect(fromPosition, CONST_ME_FIREAREA)

so the all script will by

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local gatePosition = {x=1107, y=846, z=7, stackpos=1}
        local getGate = getThingFromPos(gatePosition)
        if(item.uid == 5005) then
                if(item.itemid == 1945 and getGate.itemid == 1546) then
                        doSendMagicEffect(fromPosition, CONST_ME_FIREAREA)
						doRemoveItem(getGate.uid, 1)
                        addEvent(onTimer4, 1*60*1000)
                else
                        doPlayerSendCancel(cid, "Sorry not possible.")
                end
        end
        return 1
end

function onTimer4()

wallnewpos = {x=1107, y=846, z=7}              
                doCreateItem(1546,1,wallnewpos)
end

Thanks For Helping :)
 
Back
Top