Hi all. I have 4 scripts quests and this scripts crashed my server (tfs 0.3.6). This scripts from tfs 0.3.5. Please check and repair it :[
1.
2.
3.
4.
1.
PHP:
local playerPos =
{
[1] = {x=1037, y=1147, z=8, stackpos = 253}, -- Player Start Positions
[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
2.
PHP:
-- annihilator lever creds to WarMaker from Tibiafans
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} -- position of player 1
local player1 = getThingfromPos(player1pos)
local player2pos = {x=1037, y=1145, z=8, stackpos=253} -- position of player 2
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} --- where player 1 will be teleported
local nplayer2pos = {x=967, y=961, z=13, stackpos=253} --- where player 2 will be teleported
local demon1pos = {x=1119, y=1082, z=12, stackpos=253} -- position for demon 1
local demon2pos = {x=1129, y=1087, z=12, stackpos=253} -- position for demon 2
local demon3pos = {x=1129, y=1077, z=12, stackpos=253} -- position for demon 3
local demon4pos = {x=1129, y=1071, z=12, stackpos=253} -- position for demon 4
local demon5pos = {x=1130, y=1055, z=12, stackpos=253} -- position for demon 5
local demon6pos = {x=1130, y=1057, z=12, stackpos=253} -- position for demon 6
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
3.
PHP:
-- annihilator lever creds to WarMaker from Tibiafans
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7033 and item.itemid == 1945 then
local player1pos = {x=1040, y=1143, z=8, stackpos=253} -- position of player 1
local player1 = getThingfromPos(player1pos)
local player2pos = {x=1040, y=1145, z=8, stackpos=253} -- position of player 2
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=969, y=880, z=13, stackpos=253} --- where player 1 will be teleported
local nplayer2pos = {x=969, y=882, z=13, 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)
doTransformItem(item.uid,item.itemid+1)
end
else
doPlayerSendCancel(cid,"You need 2 players in your team.")
end
elseif item.uid ==7033 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
4.
PHP:
-- annihilator lever creds to WarMaker from Tibiafans
function onUse(cid, item, frompos, item2, topos)
if item.uid == 7044 and item.itemid == 1945 then
local player1pos = {x=1040, y=1147, z=8, stackpos=253} -- position of player 1
local player1 = getThingfromPos(player1pos)
local player2pos = {x=1040, y=1149, z=8, stackpos=253} -- position of player 2
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=894, y=802, z=13, stackpos=253} --- where player 1 will be teleported
local nplayer2pos = {x=894, y=804, z=13, 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)
doTransformItem(item.uid,item.itemid+1)
end
else
doPlayerSendCancel(cid,"You need 2 players in your team.")
end
elseif item.uid ==7044 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