Stormoguden
Professional Mapper~
Code:
local LeverPos = { x = 1037, y = 1148, z = 8} -- Lever Position
local timeToRemove = 40 -- Time before quest reset
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1945 then
local player1pos = {x=1037, y=1147, z=8, stackpos=253} -- position of player 1
local player1 = getThingfromPos(player1pos)
local player2pos = {x=1037, y=1149, z=8, stackpos=253} -- position of player 2
local player2 = getThingfromPos(player2pos)
local nplayer1pos = {x=1033, y=1146, z=11, stackpos=253} --- where player 1 will be teleported
local nplayer2pos = {x=1033, y=1148, z=11, stackpos=253} --- where player 2 will be teleported
doSendMagicEffect(player1pos,2)
doSendMagicEffect(player2pos,2)
doTeleportThing(player1.uid,nplayer1pos)
doTeleportThing(player2.uid,nplayer2pos)
doSendMagicEffect(nplayer1pos,10)
doSendMagicEffect(nplayer2pos,10)
doPlayerSendTextMessage(cid,22,"You have entered the quest!") -- Message when the lever is pulled
addEvent(doRemoveLever, timeToRemove * 1000)
else
doPlayerSendCancel(cid,"You need to be two players to do this quest.") -- message if the lever is pulled without having two players on their locations.
else if item.itemid == 1946 then
doPlayerSendCancel(cid,"The quest is already active.") -- message if the lever is pulled again.
return TRUE
end
end
end
function doRemoveLever() -- the remove trigger
local Lever = getTileItemById(LeverPos, 1946)
if Lever.uid > 0 then
doRemoveItem(Lever.uid)
doTransformItem(Lever.uid, 1945)
end
end
Okay I'm really new at lua scripting and I need help with this script to get it work. The reason why it's so fail is becouse I have no idea how to set up a script but I know how I want it. So please do me a favour and I will give you rep++
Help needed ASAP! Last thing I need to get my server going!