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

Help quest crashed server

KrychaXX

New Member
Joined
Apr 22, 2008
Messages
91
Reaction score
0
Help, I have tfs 0.3.6 and this script crashed server, this is my question , why?
This script from TFS 0.3.5

PHP:
local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 253},
    [2] = {x=1037, y=1149, z=8, stackpos = 253}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

local player1 = getThingfromPos(playerPos[1])
local player2 = getThingfromPos(playerPos[2])

function onUse(cid, item, fromPosition, itemEx, toPosition)
       if item.uid == 7001 and item.itemid == 1945 then
        if isPlayer(player1) == true and isPlayer(player2) == true then
                doTeleportThing(player1.uid, newPos[1])
                doTeleportThing(player2.uid, newPos[2])
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have entered the quest!")
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            addEvent(changeLever, 5 * 60000)
        else
            doPlayerSendCancel(cid, "You have to be 2 people to enter this quest.")
        end
    elseif (item.itemid == 1946) then
        doPlayerSendCancel(cid, "The quest is already active, you must wait.")
    end
    return TRUE
end

local function changeLever()
    if getThingfromPos(cid, cfg.leverPos) == 1946 then
        doTransformItem(item.uid, 1945)
    end
end
 
there are many errors in it

try this, then tell us
Lua:
local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 255},
    [2] = {x=1037, y=1149, z=8, stackpos = 255}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

local player1 = getThingFromPos(playerPos[1]).uid
local player2 = getThingFromPos(playerPos[2]).uid

function changeLever(item)
    return getThingfromPos(cid, cfg.leverPos).itemid == 1946 and doTransformItem(item.uid, 1945)
end  

function onUse(cid, item, fromPosition, itemEx, toPosition)
       if item.uid == 7001 and item.itemid == 1945 then
            if (isPlayer(player1) and isPlayer(player2)) then
                doTeleportThing(player1, newPos[1])
                doTeleportThing(player2, newPos[2])
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have entered the quest!')
                doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
                addEvent(changeLever,5*60000,item)
            else
                doPlayerSendCancel(cid, 'You have to be 2 people to enter this quest.')
                return false
            end
        elseif item.itemid == 1946 then
            doPlayerSendCancel(cid, 'The quest is already active, you must wait.')
            return false
        end
    return true
end
 
EDIT:
There goes CYBER with his lightning fast replies!
here a quickie fix:
Code:
local cfg = {
	levelPos = {x = , y = , z = , stackpos = 1},-- put the position of the lever
	minutes = 5 -- change in how much time will the switch change back
	}
local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 253},
    [2] = {x=1037, y=1149, z=8, stackpos = 253}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local player1 = getThingfromPos(playerPos[1])
local player2 = getThingfromPos(playerPos[2])

    if item.uid == 7001 and item.itemid == 1945 then
        if isPlayer(player1) == true and isPlayer(player2) == true then
            doTeleportThing(player1.uid, newPos[1])
            doTeleportThing(player2.uid, newPos[2])
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have entered the quest!")
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
			doTransformItem(item.uid, 1946)
            addEvent(changeLever, cfg.minutes*60*1000, cid, item)
        else
            doPlayerSendCancel(cid, "You have to be 2 people to enter this quest.")
        end
    elseif (item.itemid == 1946) then
        doPlayerSendCancel(cid, "The quest is already active, you must wait.")
    end
    return true
end

function changeLever(cid, item)
    if getThingfromPos(cfg.leverPos).itemid == 1946 then
        doTransformItem(item.uid, 1945)
    end
end
if problem persists, them please wait while i get back of hope someone helps you.
 
cid parameter is not used, so its useless:
function changeLever(cid, item)
if getThingfromPos(cfg.leverPos).itemid == 1946 then
doTransformItem(item.uid, 1945)
end
end
 
Thx, rep++ all
i have next problem with next script:

PHP:
[Error - GlobalEvent Interface] 
data/globalevents/scripts/heal.lua:onThink
Description: 
data/globalevents/scripts/heal.lua:29: bad argument #1 to 'lower' (string expected, got boolean)
stack traceback:
	[C]: in function 'lower'
	data/globalevents/scripts/heal.lua:29: in function <data/globalevents/scripts/heal.lua:19>
[Error - GlobalEvents::think] Couldn't execute event: heal


Script heal.lua
PHP:
local config = {

        healHP = 25,
        healPlayers = "yes",
        healMonsters = "yes",
}

local healthArea = {

        fromX = 1029,
        fromY = 1147,
        fromZ = 7,
        toX = 1031,
        toY = 1149,
        toZ = 7,

}

function onThink(cid, interval, lastExecution)
        for x = healthArea.fromX, healthArea.toX do
                for y = healthArea.fromY, healthArea.toY do
                        for z = healthArea.fromZ, healthArea.toZ do
                                local pos = {x=x, y=y, z=z, stackpos = 253}
                                local thing = getThingfromPos(pos)
                                doSendMagicEffect(pos, 12)
                                if thing.itemid > 0 then
                                        if(isPlayer(thing.uid) == TRUE and string.lower(config.healPlayers) == "yes") then
                                                doCreatureAddHealth(thing.uid, config.healHP)
                                                if string.lower(getConfigValue("showHealingDamage")) == "no" then
                                                        doSendAnimatedText(pos, "+"..config.healHP.."", 18)
                                                end
                                        elseif(isMonster(thing.uid) == TRUE and string.lower(config.healMonsters) == "yes") then
                                                doCreatureAddHealth(thing.uid, config.healHP)
                                                if string.lower(getConfigValue("showHealingDamageForMonsters")) == "no" then
                                                        doSendAnimatedText(pos, "+"..config.healHP.."", 18)
                                                end
                                        end
                                end
                        end
                end
        end
        return TRUE
end
 
here it is, well tabbed, with booleans fixed
edit1: missing 'end'
edit2: fixed other wrong stuff

Lua:
local config = {
    healHP = 25,
    healPlayers = true, --options: true or false
    healMonsters = true,
}

local healthArea = {
    fromX = 1029,
    fromY = 1147,
    fromZ = 7,
    toX = 1031,
    toY = 1149,
    toZ = 7
}

function onThink(cid, interval, lastExecution)
    for x = healthArea.fromX, healthArea.toX do
        for y = healthArea.fromY, healthArea.toY do
            for z = healthArea.fromZ, healthArea.toZ do
                local pos = {x=x, y=y, z=z, stackpos = 253}
                local thing = getThingFromPos(pos)
                doSendMagicEffect(pos, 12)
                if thing.itemid > 0 then
                    if (isPlayer(thing.uid) and config.healPlayers) then
                        doCreatureAddHealth(thing.uid, config.healHP)
                        if getConfigValue('showHealingDamage') then
                            doSendAnimatedText(pos, '+'..config.healHP, 18)
                        end
                    end    
                    if (isMonster(thing.uid) and config.healMonsters) then
                        doCreatureAddHealth(thing.uid, config.healHP)
                        if getConfigValue('showHealingDamageForMonsters') then
                            doSendAnimatedText(pos, '+'..config.healHP, 18)
                        end
                    end
                end
            end
        end
    end
    return true
end



 
Last edited:
Your script dont work, script 375 dont test

i use this script and dont crash server

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

local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 255},
    [2] = {x=1037, y=1149, z=8, stackpos = 255}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

local player1 = getThingFromPos(playerPos[1]).uid
local player2 = getThingFromPos(playerPos[2]).uid

function changeLever(item)
    return getThingfromPos(cid, cfg.leverPos).itemid == 1946 and doTransformItem(item.uid, 1945)
end  

function onUse(cid, item, fromPosition, itemEx, toPosition)
       if item.uid == 7001 and item.itemid == 1945 then
            if (isPlayer(player1) and isPlayer(player2)) then
                doTeleportThing(player1, newPos[1])
                doTeleportThing(player2, newPos[2])
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have entered the quest!')
                doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
                addEvent(changeLever,5*60000,item)
            else
                doPlayerSendCancel(cid, 'You have to be 2 people to enter this quest.')
                return false
            end
        elseif item.itemid == 1946 then
            doPlayerSendCancel(cid, 'The quest is already active, you must wait.')
            return false
        end
    return true
end

But i have this error:

PHP:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/poisonsewers.lua:39: 'end' expected (to close 'function' at line 1) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/poisonsewers.lua)
data/actions/scripts/poisonsewers.lua:39: 'end' expected (to close 'function' at line 1) near '<eof>'
 
this, fixed like 4 times
Lua:
  local config = {
    healHP = 25,
    healPlayers = true, --options: true or false
    healMonsters = true,
}

local healthArea = {
    fromX = 1029,
    fromY = 1147,
    fromZ = 7,
    toX = 1031,
    toY = 1149,
    toZ = 7
}

function onThink(cid, interval, lastExecution)
    for x = healthArea.fromX, healthArea.toX do
        for y = healthArea.fromY, healthArea.toY do
            for z = healthArea.fromZ, healthArea.toZ do
                local pos = {x=x, y=y, z=z, stackpos = 253}
                local thing = getThingFromPos(pos)
                doSendMagicEffect(pos, 12)
                if thing.itemid > 0 then
                    if (isPlayer(thing.uid) and config.healPlayers) then
                        doCreatureAddHealth(thing.uid, config.healHP)
                        if getConfigValue('showHealingDamage') then
                            doSendAnimatedText(pos, '+'..config.healHP, 18)
                        end
                    end    
                    if (isMonster(thing.uid) and config.healMonsters) then
                        doCreatureAddHealth(thing.uid, config.healHP)
                        if getConfigValue('showHealingDamageForMonsters') then
                            doSendAnimatedText(pos, '+'..config.healHP, 18)
                        end
                    end
                end
            end
        end
    end
    return true
end
 
Thx i try again. I have this script:

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

local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 255},
    [2] = {x=1037, y=1149, z=8, stackpos = 255}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

local player1 = getThingFromPos(playerPos[1]).uid
local player2 = getThingFromPos(playerPos[2]).uid

function changeLever(item)
    return getThingfromPos(cid, cfg.leverPos).itemid == 1946 and doTransformItem(item.uid, 1945)
end  

function onUse(cid, item, fromPosition, itemEx, toPosition)
       if item.uid == 7001 and item.itemid == 1945 then
            if (isPlayer(player1) and isPlayer(player2)) then
                doTeleportThing(player1, newPos[1])
                doTeleportThing(player2, newPos[2])
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have entered the quest!')
                doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
                addEvent(changeLever,5*60000,item)
            else
                doPlayerSendCancel(cid, 'You have to be 2 people to enter this quest.')
                return false
            end
        elseif item.itemid == 1946 then
            doPlayerSendCancel(cid, 'The quest is already active, you must wait.')
            return false
        end
    return true
end

and i have this error:
PHP:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/poisonsewers.lua:39: 'end' expected (to close 'function' at line 1) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/poisonsewers.lua)
data/actions/scripts/poisonsewers.lua:39: 'end' expected (to close 'function' at line 1) near '<eof>'
 
:p lawl i did that?
Lua:
local playerPos =
{
    [1] = {x=1037, y=1147, z=8, stackpos = 255},
    [2] = {x=1037, y=1149, z=8, stackpos = 255}
}

local newPos =
{
    [1] = {x=1033, y=1146, z=11}, -- New Player Positions
    [2] = {x=1033, y=1148, z=11}
}

local player1 = getThingFromPos(playerPos[1]).uid
local player2 = getThingFromPos(playerPos[2]).uid

function changeLever(item)
    return getThingfromPos(cid, cfg.leverPos).itemid == 1946 and doTransformItem(item.uid, 1945)
end  

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.uid == 7001 and item.itemid == 1945 then
        if (isPlayer(player1) and isPlayer(player2)) then
            doTeleportThing(player1, newPos[1])
            doTeleportThing(player2, newPos[2])
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have entered the quest!')
            doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
            addEvent(changeLever,5*60000,item)
        else
            doPlayerSendCancel(cid, 'You have to be 2 people to enter this quest.')
            return false
        end
        if item.itemid == 1946 then
            doPlayerSendCancel(cid, 'The quest is already active, you must wait.')
            return false
        end
    end
    return true
end
 
Without this line server crashed ... :/
function onUse(cid, item, frompos, item2, topos)

I have this line from this script:
PHP:
function onUse(cid, item, frompos, item2, topos)

   	if item.uid == 7022 and item.itemid == 1945 then
		local player1pos = {x=1037, y=1143, z=8, stackpos=253}
		local player1 = getThingfromPos(player1pos)

		local player2pos = {x=1037, y=1145, z=8, stackpos=253}
		local player2 = getThingfromPos(player2pos)


		if player1.itemid > 0 and player2.itemid > 0 then
			local queststatus1 = getPlayerStorageValue(player1.uid,7001)
			local queststatus2 = getPlayerStorageValue(player2.uid,7001)

			if queststatus1 == -1 and queststatus2 == -1 then
			
				local nplayer1pos = {x=967, y=959, z=13, stackpos=253}
				local nplayer2pos = {x=967, y=961, z=13, stackpos=253}
				
				local demon1pos = {x=1119, y=1082, z=12, stackpos=253}
				local demon2pos = {x=1129, y=1087, z=12, stackpos=253}
				local demon3pos = {x=1129, y=1077, z=12, stackpos=253}
				local demon4pos = {x=1129, y=1071, z=12, stackpos=253}
				local demon5pos = {x=1130, y=1055, z=12, stackpos=253}
				local demon6pos = {x=1130, y=1057, z=12, stackpos=253}

				doSendMagicEffect(player1pos,2)
				doSendMagicEffect(player2pos,2)
				

				doTeleportThing(player1.uid,nplayer1pos)
				doTeleportThing(player2.uid,nplayer2pos)

				doSendMagicEffect(nplayer1pos,10)
				doSendMagicEffect(nplayer2pos,10)

				doTransformItem(item.uid,item.itemid+1)
		end

		else
			doPlayerSendCancel(cid,"You need 2 players in your team.")
		end

	elseif item.uid ==7022 and item.itemid == 1946 then
		if getPlayerAccess(cid) > 0 then
			doTransformItem(item.uid,item.itemid-1)
			end

addEvent(reset, 15*60*1000, item)

function reset(item)
   doTransformItem(item.uid, item.itemid-1)
end
		end
	return 1
end
 
Back
Top