• 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!

Lua Script Help

Zarabustor

Human Being
Joined
Sep 10, 2009
Messages
186
Reaction score
0
Location
Cancun, Mexico
i got a problem with this script dont works, im using tfs 3.6
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUST)
local temple = {x = 504, y = 504, z = 7}
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerTown(cid)
effect = math.random (1, 215)
pos = getPlayerPosition(cid)
if getCreatureCondition(cid, CONDITION_EXHAUSTED) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
doSendMagicEffect(pos,2)
doTeleportThing(cid, temple)
doRemoveItem(cid, (item.uid), 1)
doAddCondition(cid, exhaust)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You are in a fight!")
end
return 1
end
 
Any error in console?
Btw, try this:
LUA:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUST)
local temple = {x=504, y=504, z=7}
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
temple = getPlayerTown(cid)
effect = math.random(1, 215)
pos = getPlayerPosition(cid)

if getCreatureCondition(cid, CONDITION_EXHAUSTED) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
elseif getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
doRemoveItem(item.uid, 1)
doSendMagicEffect(pos,2)
doTeleportThing(cid, temple)
doAddCondition(cid, exhaust)
else
doPlayerSendCancel(cid,"You are in a fight!")
end
return TRUE
end
 
[14/01/2010 12:34:23] [Error - Action Interface]
[14/01/2010 12:34:23] data/actions/scripts/andres/advancescroll.lua:onUse
[14/01/2010 12:34:23] Description:
[14/01/2010 12:34:23] attempt to index a number value
[14/01/2010 12:34:23] stack traceback:
[14/01/2010 12:34:23] [C]: in function 'doTeleportThing'
[14/01/2010 12:34:23] data/actions/scripts/andres/advancescroll.lua:17: in function <data/actions/scripts/andres/advancescroll.lua:6>
 
Then, this:
LUA:
local exhausttime = 20 * 60 * 1000
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhausttime)

function onUse(cid, item, frompos, item2, topos)
local templeid = getPlayerTown(cid)
local temple = getTownTemplePosition(templeid)
local effect = math.random(1, 215)
local pos = getPlayerPosition(cid)

if getCreatureCondition(cid, CONDITION_EXHAUST) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
doSendMagicEffect(pos,2)
doAddCondition(cid, exhaust)
doTeleportThing(cid, temple)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You are in a fight!")
end
return TRUE
end
 
man please help me supously this script is an advanced teleport scroll the script make a teleport in front of you and when you used the item then it dissaper in 10 second and you cant use it during a fight and ech 60 second :D
please help me to fix it
 
If it makes a teleport in front of you, in that 10 second every player can enter to the teleport. Then, you want me to make that script, or it already exists?
 
Here it is:
LUA:
-- Advanced Teleport Script // by Xampy --

function onUse(cid, item, frompos, item2, topos)
        local templeid = getPlayerTown(cid)
        local temple = getTownTemplePosition(templeid)
        local position = getPlayerPosition(cid)
        local positionn = position
        local exhausttime = 60 -- in seconds

local function removeTP()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doRemoveItem(posTP)
        end
end

local function nineSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '9', TEXTCOLOR_RED)
        end
end

local function eightSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '8', TEXTCOLOR_RED)
        end
end

local function sevenSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '7', TEXTCOLOR_RED)
        end
end

local function sixSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '6', TEXTCOLOR_RED)
        end
end

local function fiveSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '5', TEXTCOLOR_RED)
        end
end

local function fourSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '4', TEXTCOLOR_RED)
        end
end

local function threeSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '3', TEXTCOLOR_RED)
        end
end

local function twoSeconds()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '2', TEXTCOLOR_RED)
        end
end

local function oneSecond()
        local posTP = getTileItemById(positionn, 1387).uid
        if posTP ~= nil then
                doSendAnimatedText(positionn, '1', TEXTCOLOR_RED)
        end
end


        if getPlayerStorageValue(cid, 558555) > os.time() then
                if (getPlayerStorageValue(cid, 558555) - os.time()) == 1 then
                        letter = ""
                else
                        letter = "s"
                end
                doPlayerSendCancel(cid, 'You must wait ' .. getPlayerStorageValue(cid, 558555) - os.time() .. ' second' .. letter .. '.')
                doSendMagicEffect(position, 2)
                return TRUE
        elseif getCreatureCondition(cid, CONDITION_EXHAUST) == FALSE and getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
                        doCreateTeleport(1387, temple, position)
                        setPlayerStorageValue(cid, 558555, os.time() + exhausttime)
                        doRemoveItem(item.uid, 1)
                        doSendAnimatedText(position, '10', TEXTCOLOR_RED)
                        addEvent(nineSeconds, 1000)
                        addEvent(eightSeconds, 2000)
                        addEvent(sevenSeconds, 3000)
                        addEvent(sixSeconds, 4000)
                        addEvent(fiveSeconds, 5000)
                        addEvent(fourSeconds, 6000)
                        addEvent(threeSeconds, 7000)
                        addEvent(twoSeconds, 8000)
                        addEvent(oneSecond, 9000)
                        addEvent(removeTP, 10000)
        else
                doPlayerSendCancel(cid, 'You are in a fight!')
        end

        return TRUE
end
 
Last edited:
Back
Top