Ezzam
New Member
- Joined
- Jan 16, 2008
- Messages
- 213
- Reaction score
- 2
Code:
function onUse(cid, item, frompos, item2, topos)
local config = {
--Lever IDs (Ignore unless you change lever)--
switchUniqueID = 16000,
switchID = 1945,
switch2ID = 1946,
--ItemID of all the items--
swordID = 2376,
crossbowID = 2455,
appleID = 2674,
spellbookID = 2175,
--Where the player should put the item--
piece1pos = {x=32673, y=32083, z=8, stackpos=1}, --SwordID (Knight)--
piece2pos = {x=32673, y=32094, z=8, stackpos=1}, --CrossbowID (Paladin)--
piece3pos = {x=32667, y=32089, z=8, stackpos=1}, --AppleID (Druid)--
piece4pos = {x=32679, y=32089, z=8, stackpos=1}, --SpellbookID (Sorcerer)--
--Where you stand before the teleport--
player1pos = {x=32673, y=32085, z=8, stackpos=253}, -- Knight (North)
player2pos = {x=32673, y=32093, z=8, stackpos=253}, -- Paladin (South)
player3pos = {x=32669, y=32089, z=8, stackpos=253}, -- Druid (West)
player4pos = {x=32677, y=32089, z=8, stackpos=253}, -- Sorcerer (East)
-- Where you get after the teleport --
nplayer1pos = {x=32671, y=32069, z=8}, --Knight--
nplayer2pos = {x=32672, y=32069, z=8}, --Paladin--
nplayer3pos = {x=32671, y=32070, z=8}, --Druid--
nplayer4pos = {x=32672, y=32070, z=8} --Sorcerer--
}
----------------------------------------------
------------------Don't Edit------------------
----------------------------------------------
--Checks IDs on the items--
getpiece1 = getThingfromPos(config.piece1pos)
getpiece2 = getThingfromPos(config.piece2pos)
getpiece3 = getThingfromPos(config.piece3pos)
getpiece4 = getThingfromPos(config.piece4pos)
--Get player.uid from pos--
player1 = getThingfromPos(config.player1pos)
player2 = getThingfromPos(config.player2pos)
player3 = getThingfromPos(config.player3pos)
player4 = getThingfromPos(config.player4pos)
--Checks vocation on players--
knightvoc = getPlayerVocation(player1.uid)
paladinvoc = getPlayerVocation(player2.uid)
druidvoc = getPlayerVocation(player3.uid)
sorcerervoc = getPlayerVocation(player4.uid)
--Checks level on players--
player1level = getPlayerLevel(player1.uid)
player2level = getPlayerLevel(player2.uid)
player3level = getPlayerLevel(player3.uid)
player4level = getPlayerLevel(player4.uid)
if knightvoc == 4 or knightvoc == 8 and paladinvoc == 3 or paladinvoc == 7 and druidvoc == 2 or druidvoc == 6 and sorcerervoc == 1 or sorcerervoc == 5 then
if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then
if item.uid == config.switchUniqueID and item.itemid == config.switchID and getpiece1.itemid == config.swordID and getpiece2.itemid == config.crossbowID and getpiece3.itemid == config.appleID and getpiece4.itemid == config.spellbookID then
doSendMagicEffect(config.player1pos,2)
doTeleportThing(player1.uid,config.nplayer1pos)
doSendMagicEffect(config.nplayer1pos,10)
doRemoveItem(getpiece1.uid,1)
doSendMagicEffect(config.player2pos,2)
doTeleportThing(player2.uid,config.nplayer2pos)
doSendMagicEffect(config.nplayer2pos,10)
doRemoveItem(getpiece2.uid,1)
doSendMagicEffect(config.player3pos,2)
doTeleportThing(player3.uid,config.nplayer3pos)
doSendMagicEffect(config.nplayer3pos,10)
doRemoveItem(getpiece3.uid,1)
doSendMagicEffect(config.player4pos,2)
doTeleportThing(player4.uid,config.nplayer4pos)
doSendMagicEffect(config.nplayer4pos,10)
doRemoveItem(getpiece4.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == switchUniqueID and item.itemid == switch2ID then
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, you need to put the correct stuffs at the correct basins.")
end
else
doPlayerSendCancel(cid,"Sorry, all players in your team must to be level " .. questlevel .. ".")
end
else
return FALSE
end
else
doPlayerSendCancel(cid,"Sorry, all 4 players must be on right positions.")
end
return TRUE
end