--/////Configuration\\\\\--
local cfg = {
switchUniqueID = 10034, -- change to the unique id that you want to use for the lever
switchID = 1945, -- don't change
switch2ID = 1946,
Item1ID = 0000, -- change to the type of item that the player1 must place
Item2ID = 0000, -- change to the type of item that the player2 must place
Item3ID = 0000, -- change to the type of item that the player3 must place
Item4ID = 0000, -- change to the type of item that the player4 must place
questlevel = 100, -- change the required level for players to do this quest
piece1pos = {x=XXXX, y=YYYY, z=Z, stackpos=1}, -- change to where the first piece will be placed
piece2pos = {x=XXXX, y=YYYY, z=Z, stackpos=1}, -- change to where the second piece will be placed
piece3pos = {x=XXXX, y=YYYY, z=Z, stackpos=1}, -- change to where the third piece will be placed
piece4pos = {x=XXXX, y=YYYY, z=Z, stackpos=1}, -- change to where the fourth piece will be placed
player1pos = {x=1090, y=1006, z=8, stackpos=253}, -- change to where player1 will stand before pressing lever (do not change the 'stackpos' of any of them)
player2pos = {x=1090, y=1004, z=8, stackpos=253}, -- change to where player2 will stand before pressing lever
player3pos = {x=1088, y=1004, z=8, stackpos=253}, -- change to where player3 will stand before pressing lever
player4pos = {x=1088, y=1006, z=8, stackpos=253}, -- change to where player4 will stand before pressing lever
nplayer1pos = {x=1049, y=1079, z=10}, -- change to the new position of player1
nplayer2pos = {x=1050, y=1079, z=10}, -- change to the new position of player2
nplayer3pos = {x=1049, y=1080, z=10}, -- change to the new position of player3
nplayer4pos = {x=1050, y=1080, z=10} -- change to the new position of player4
}
--\\\\\Configuration/////--
function onUse(cid, item, frompos, item2, topos)
--//Get Item Pos\\--
getpiece1 = getThingfromPos(cfg.piece1pos)
--
getpiece2 = getThingfromPos(cfg.piece2pos)
--
getpiece3 = getThingfromPos(cfg.piece3pos)
--
getpiece4 = getThingfromPos(cfg.piece4pos)
--
--//Get Player Pos\\--
player1 = getThingfromPos(cfg.player1pos)
--
player2 = getThingfromPos(cfg.player2pos)
--
player3 = getThingfromPos(cfg.player3pos)
--
player4 = getThingfromPos(cfg.player4pos)
--
if player1.itemid > 0 and --
player2.itemid > 0 and --
player3.itemid > 0 and --
player4.itemid > 0 then --
--
player1level = getPlayerLevel(player1.uid) -- Checking the level of player1
player2level = getPlayerLevel(player2.uid) -- Checking the level of player2
player3level = getPlayerLevel(player3.uid) -- Checking the level of player3
player4level = getPlayerLevel(player4.uid) -- Checking the level of player4
--
-- check if they all players are on right positions -------------------------------------------------------------------
if player1level >= cfg.questlevel and
player2level >= cfg.questlevel and
player3level >= cfg.questlevel and
player4level >= cfg.questlevel then
if item.uid == cfg.switchUniqueID and
item.itemid == cfg.switchID and
getpiece1.itemid == cfg.Item1ID and
getpiece2.itemid == cfg.Item2ID and
getpiece3.itemid == cfg.Item3ID and
getpiece4.itemid == cfg.Item4ID then
-- sends an "poff" to the old pos --
doSendMagicEffect(player1pos,2)
doSendMagicEffect(player2pos,2)
doSendMagicEffect(player3pos,2)
doSendMagicEffect(player4pos,2)
-- teleports the players to the new pos ---
doTeleportThing(player1.uid,cfg.nplayer1pos)
doTeleportThing(player2.uid,cfg.nplayer2pos)
doTeleportThing(player3.uid,cfg.nplayer3pos)
doTeleportThing(player4.uid,cfg.nplayer4pos)
-- sends an "glimmer" to the new pos --
doSendMagicEffect(cfg.nplayer1pos,10)
doSendMagicEffect(cfg.nplayer2pos,10)
doSendMagicEffect(cfg.nplayer3pos,10)
doSendMagicEffect(cfg.nplayer4pos,10)
-- removes the items ---------------
doRemoveItem(getpiece1.uid,1)
doRemoveItem(getpiece2.uid,1)
doRemoveItem(getpiece3.uid,1)
doRemoveItem(getpiece4.uid,1)
doTransformItem(item.uid,item.itemid+1)
--elseif item.uid == switchUniqueID and --Why? then you will still pull the lever when the items are incorrect and no error messages will be send
--item.itemid == switch2ID then
--doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, you need to put the correct items on the correct basins.")
end
else
doPlayerSendCancel(cid,"Sorry, all players in your team must be at least level " .. cfg.questlevel .. ".")
end
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end