• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 0.3.5] Help to get this script working

Stormoguden

Professional Mapper~
Joined
Nov 3, 2008
Messages
442
Reaction score
6
Location
Sweden/Stockholm
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!
 
First off.. The script was broken anyways =|

Code:
local LeverPos      = { x = 1037, y = 1148, z = 8} -- Lever Position
local timeToRemove  = 40 -- Time before quest reset
local player1pos = {x=1037, y=1147, z=8, stackpos=253} -- position of player 1local 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

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

        if item.itemid == 1945 then
                                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)
            elseif item.itemid == 1946 then
        doPlayerSendCancel(cid,"The quest is already active.") -- message if the lever is pulled again.
	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.
        end
           return TRUE
           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
 
Hum, im getting really confused, when I added your script now I can't even start the server haha failing at Loading script systems ;SS
Anyways rep for trying to help!


Code:
local LeverPos      = { x = 1037, y = 1148, z = 8} -- Lever Position
local timeToRemove  = 40 -- Time before quest reset
local player1pos = {x=1037, y=1147, z=8, stackpos=253} -- position of player 1local 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

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

        if item.itemid == 1945 then
                                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)
            elseif item.itemid == 1946 then
        doPlayerSendCancel(cid,"The quest is already active.") -- message if the lever is pulled again.
	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.
        end
           return TRUE
           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

Anyways I deleted this cuz it removed the lever completely
Code:
        doRemoveItem(Lever.uid)
and now it works, the problem is to start the server, the server cant start with this script, I have to add it when the server is on and reload actions..
 
Last edited:
Back
Top