Hello people!
Im with a big trouble ( again lol)
Well, this script is working ( please dont blame my scripts, they are simple but functional! hehe)
but there is a problem, when someone stands on a lever, and other pull a wrong lever, instead of transforming the lever to the ID 1945, it creates a new lever over the actual lever.
So, the lever stands with ID 1946, and is created a new one over that lever the 1946 one, with ID 1945... I think there is something with stackpos?? because this only happens when are players standing on the levers.
thanks!
here are the scripts ( 4 script,1 for each lever!)
first lever
second lever
third lever
last lever
Im with a big trouble ( again lol)
Well, this script is working ( please dont blame my scripts, they are simple but functional! hehe)
but there is a problem, when someone stands on a lever, and other pull a wrong lever, instead of transforming the lever to the ID 1945, it creates a new lever over the actual lever.
So, the lever stands with ID 1946, and is created a new one over that lever the 1946 one, with ID 1945... I think there is something with stackpos?? because this only happens when are players standing on the levers.
thanks!
here are the scripts ( 4 script,1 for each lever!)
first lever
Code:
function onUse(cid, item, frompos, item2, topos)
local lever = {x=32761, y=32291, z=14, stackpos=1}
local getlever = getThingfromPos(lever)
local wall = {x=32761, y=32292, z=14, stackpos=1}
local getwall = getThingfromPos(wall)
if item.actionid == 5410 and getGlobalStorageValue(cid, 5410) <= 1 and item.itemid == 1945 then
doTransformItem(item.uid, 1946)
setGlobalStorageValue(cid, 5410, 2)
doRemoveItem(getwall.uid,1)
doRemoveItem(getThingfromPos({x=wall.x+1,y=wall.y,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x+2,y=wall.y,z=wall.z, stackpos=1}).uid,1)
elseif item.actionid == 5410 and getGlobalStorageValue(cid, 5410) == 2 and item.itemid == 1946 then
doTransformItem(item.uid, 1945)
doCreateItem(1026,1,wall)
doCreateItem(1026,1,{x=wall.x+1,y=wall.y,z=wall.z, stackpos=1})
doCreateItem(1026,1,{x=wall.x+2,y=wall.y,z=wall.z, stackpos=1})
setGlobalStorageValue(cid, 5410, 0)
end
return 1
end
second lever
Code:
function onUse(cid, item, frompos, item2, topos)
local lever = {x=32763, y=32291, z=14, stackpos=1}
local getlever = getThingfromPos(lever)
local wall2 = {x=32761, y=32292, z=14, stackpos=1}
local getwall2 = getThingfromPos(wall2)
local wall = {x=32760, y=32292, z=14, stackpos=1}
local getwall = getThingfromPos(wall)
if item.actionid == 5411 and getGlobalStorageValue(cid, 5410) == 2 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 3)
doRemoveItem(getwall.uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-1,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-2,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-3,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-4,z=wall.z, stackpos=1}).uid,1)
doTransformItem(item.uid, 1946)
elseif item.actionid == 5411 and getGlobalStorageValue(cid, 5410) == 3 and item.itemid == 1946 then
setGlobalStorageValue(cid, 5410, 2)
doCreateItem(1025,1,wall)
doCreateItem(1025,1,{x=wall.x,y=wall.y-1,z=wall.z, stackpos=1})
doCreateItem(1025,1,{x=wall.x,y=wall.y-2,z=wall.z, stackpos=1})
doCreateItem(1025,1,{x=wall.x,y=wall.y-3,z=wall.z, stackpos=1})
doCreateItem(1027,1,{x=wall.x,y=wall.y-4,z=wall.z, stackpos=1})
doTransformItem(item.uid, 1945)
end
return 1
end
third lever
Code:
function onUse(cid, item, frompos, item2, topos)
local lever = {x=32763, y=32291, z=14, stackpos=1}
local getlever = getThingfromPos(lever)
local wall1 = {x=32761, y=32292, z=14, stackpos=1}
local getwall1 = getThingfromPos(wall1)
local wall2 = {x=32760, y=32292, z=14, stackpos=1}
local getwall2 = getThingfromPos(wall2)
local wall = {x=32764, y=32292, z=14, stackpos=1}
local getwall = getThingfromPos(wall)
if item.actionid == 5412 and getGlobalStorageValue(cid, 5410) == 3 and item.itemid == 1945 then
doTransformItem(item.uid, 1946)
setGlobalStorageValue(cid, 5410, 4)
doRemoveItem(getwall.uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-1,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-2,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x,y=wall.y-3,z=wall.z, stackpos=1}).uid,1)
elseif item.actionid == 5412 and getGlobalStorageValue(cid, 5410) == 4 and item.itemid == 1946 then
doTransformItem(item.uid, 1945)
setGlobalStorageValue(cid, 5410, 3)
doCreateItem(1029,1,wall)
doCreateItem(1025,1,{x=wall.x,y=wall.y-1,z=wall.z, stackpos=1})
doCreateItem(1025,1,{x=wall.x,y=wall.y-2,z=wall.z, stackpos=1})
doCreateItem(1025,1,{x=wall.x,y=wall.y-3,z=wall.z, stackpos=1})
elseif item.actionid == 5412 and getGlobalStorageValue(cid, 5410) < 1 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 0)
elseif item.actionid == 5412 and getGlobalStorageValue(cid, 5410) == 2 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 0)
doCreateItem(1026,1,wall1)
doCreateItem(1026,1,{x=wall1.x+1,y=wall1.y,z=wall1.z, stackpos=1})
doCreateItem(1026,1,{x=wall1.x+2,y=wall1.y,z=wall1.z, stackpos=1})
doTransformItem(getlever.uid, 1945)
end
return 1
end
Code:
function onUse(cid, item, frompos, item2, topos)
local lever = {x=32763, y=32291, z=14, stackpos=1}
local getlever = getThingfromPos(lever)
local wall3 = {x=32760, y=32292, z=14, stackpos=1}
local getwall3 = getThingfromPos(wall3)
local wall1 = {x=32761, y=32292, z=14, stackpos=1}
local getwall1 = getThingfromPos(wall1)
local wall2 = {x=32760, y=32292, z=14, stackpos=1}
local getwall2 = getThingfromPos(wall2)
local wall = {x=32761, y=32288, z=14, stackpos=1}
local getwall = getThingfromPos(wall)
if item.actionid == 5413 and getGlobalStorageValue(cid, 5410) == 4 and item.itemid == 1945 then
doTransformItem(item.uid, 1946)
setGlobalStorageValue(cid, 5410, 5)
doRemoveItem(getwall.uid,1)
doRemoveItem(getThingfromPos({x=wall.x+1,y=wall.y,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x+2,y=wall.y,z=wall.z, stackpos=1}).uid,1)
doRemoveItem(getThingfromPos({x=wall.x+3,y=wall.y,z=wall.z, stackpos=1}).uid,1)
elseif item.actionid == 5413 and getGlobalStorageValue(cid, 5410) == 5 and item.itemid == 1946 then
doTransformItem(item.uid, 1945)
setGlobalStorageValue(cid, 5410, 4)
doCreateItem(1026,1,wall)
doCreateItem(1026,1,{x=wall.x+1,y=wall.y,z=wall.z, stackpos=1})
doCreateItem(1026,1,{x=wall.x+2,y=wall.y,z=wall.z, stackpos=1})
doCreateItem(1026,1,{x=wall.x+3,y=wall.y,z=wall.z, stackpos=1})
elseif item.actionid == 5413 and getGlobalStorageValue(cid, 5410) < 1 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 0)
elseif item.actionid == 5413 and getGlobalStorageValue(cid, 5410) == 2 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 0)
doCreateItem(1026,1,wall1)
doCreateItem(1026,1,{x=wall1.x+1,y=wall1.y,z=wall1.z, stackpos=1})
doCreateItem(1026,1,{x=wall1.x+2,y=wall1.y,z=wall1.z, stackpos=1})
doTransformItem(getlever.uid, 1945)
elseif item.actionid == 5413 and getGlobalStorageValue(cid, 5410) == 3 and item.itemid == 1945 then
setGlobalStorageValue(cid, 5410, 0)
doCreateItem(1026,1,wall1)
doCreateItem(1026,1,{x=wall1.x+1,y=wall1.y,z=wall1.z, stackpos=1})
doCreateItem(1026,1,{x=wall1.x+2,y=wall1.y,z=wall1.z, stackpos=1})
doTransformItem(getlever.uid, 1945)
doCreateItem(1025,1,wall3)
doCreateItem(1025,1,{x=wall3.x,y=wall3.y-1,z=wall3.z, stackpos=1})
doCreateItem(1025,1,{x=wall3.x,y=wall3.y-2,z=wall3.z, stackpos=1})
doCreateItem(1025,1,{x=wall3.x,y=wall3.y-3,z=wall3.z, stackpos=1})
doCreateItem(1027,1,{x=wall3.x,y=wall3.y-4,z=wall3.z, stackpos=1})
doTransformItem(getThingfromPos({x=lever.x-2,y=lever.y,z=lever.z, stackpos=1}).uid, 1945)
end
return 1
end