• 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 Lever create X and remove X

Sizaro

Advanced OT User
Joined
Aug 20, 2007
Messages
5,152
Solutions
5
Reaction score
210
Location
Sweden
GitHub
coldensjo
1.
Lua:
local wall = {x=9872, y=10216, z=9, stackpos=1}
local wall2 = {x=9873, y=10216, z=9, stackpos=1}
local getwall = getThingfromPos(wall) 
local getwall2 = getThingfromPos(wall2)

function onUse(cid, item, frompos, item2, topos)

        if item.uid == 45002 and item.itemid == 1945 then
              doTransformItem(item.uid,item.itemid+1)
              doCreateItem(7524, 1, wall)
              doCreateItem(1745, 1, wall2)
        elseif item.uid == 45002 and item.itemid == 1946 then
              doTransformItem(item.uid,item.itemid-1)
              doRemoveItem(getwall.uid)
              doRemoveItem(getwall2.uid)
        end
    return 1
 end

= Server crash

2.

Lua:
local wall = {x=9872, y=10216, z=9, stackpos=1}
local wall2 = {x=9873, y=10216, z=9, stackpos=1}
local getwall = getThingfromPos(wall) 
local getwall2 = getThingfromPos(wall2)

function onUse(cid, item, frompos, item2, topos)

        if item.uid == 45002 and item.itemid == 1945 then
              doTransformItem(item.uid,item.itemid+1)
              doCreateItem(7524, 1, wall)
              doCreateItem(1745, 1, wall2)
        elseif item.uid == 45002 and item.itemid == 1946 then
              doTransformItem(item.uid,item.itemid-1)
              doRemoveItem(getwall.uid)
              doRemoveItem(getwall2.uid)
              end
        end
    return 1
 end

=
Warning: [Event::checkScript] Can not load script. /scripts/levers/lever_bluelegsq.lua
data/actions/scripts/levers/lever_bluelegsq.lua:19: '<eof>' expected near 'end'
 
Last edited:
Lua:
local wall = {x=9872, y=10216, z=9, stackpos=1}
local wall2 = {x=9873, y=10216, z=9, stackpos=1}
local getwall = getThingfromPos(wall) 
local getwall2 = getThingfromPos(wall2)

function onUse(cid, item, frompos, item2, topos)

        if item.uid == 45002 and item.itemid == 1945 then
              doTransformItem(item.uid,item.itemid+1)
              doCreateItem(7524, 1, wall)
              doCreateItem(1745, 1, wall2)
        elseif item.uid == 45002 and item.itemid == 1946 then
              doTransformItem(item.uid,item.itemid-1)
              doRemoveItem(getwall.uid)
              doRemoveItem(getwall2.uid)
        end
    return 1
 end

Try this..
 
Try this script:

Lua:
local wall = {x=9872, y=10216, z=9, stackpos=1}
local wall2 = {x=9873, y=10216, z=9, stackpos=1}
local getwall = getThingfromPos(wall) 
local getwall2 = getThingfromPos(wall2)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
        if item.uid == 45002 and item.itemid == 1945 then
              doTransformItem(item.uid,item.itemid+1)
              doCreateItem(7524, 1, wall)
              doCreateItem(1745, 1, wall2)
        elseif item.uid == 45002 and item.itemid == 1946 then
              doTransformItem(item.uid,item.itemid-1)
              doRemoveItem(getwall.uid)
              doRemoveItem(getwall2.uid)
        end
 end
 
local getwall = getThingfromPos(wall)
local getwall2 = getThingfromPos(wall2)

dont do that outside of the function
 
Fixed it

Lua:
local wall = {x=9872, y=10216, z=9, stackpos=1}
local wall2 = {x=9873, y=10216, z=9, stackpos=1}
 
function onUse(cid, item, frompos, item2, topos)

local getwall = getThingfromPos(wall)
local getwall2 = getThingfromPos(wall2)  

        if item.uid == 45002 and item.itemid == 1945 then
			doTransformItem(item.uid,item.itemid+1)
			doCreateItem(7524, 1, wall)
			doCreateItem(1745, 1, wall2)
		elseif item.uid == 45002 and item.itemid == 1946 then
			doTransformItem(item.uid,item.itemid-1)
			doRemoveItem(getwall.uid)
			doRemoveItem(getwall2.uid)
        end
	return false
 end
 
Back
Top