i was testing this script and id didnt work, then i noticed that the t is 0 , then it enters the if and says you need 3 players for this quest" , the question is why? there are 3 players on the top of the sqm, and positions are crrect, i checked and re checked
using tfs 0.3.6pl1
using tfs 0.3.6pl1
Lua:
-- Quest level 40 by Rama v 1.0 --
local from={x=1199, y=1050, z=8}
local to={x=1254, y=1104, z=8}
local playerA={
{x=1118, y=1043, z=10},
{x=1118, y=1044, z=10},
{x=1118, y=1045, z=10}
}
local playerB={
{x=1243, y=1088, z=8},
{x=1244, y=1088, z=8},
{x=1242, y=1088, z=8}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {}
if item.itemid == 1945 then
for i = 1, 3 do
t[i]=getTopCreature(playerA[i]).uid
if t[i] == 0 or not isPlayer(t[i]) then
return doPlayerSendCancel(cid, 'You need 3 players for this quest.')
elseif getPlayerLevel(t[i]) < 40 then
return doPlayerSendCancel(cid, 'All players need to have level 40 or higher.')
end
end
for i = 1, 3 do
doTeleportThing(t[i], playerB[i])
doSendMagicEffect(playerA[i], CONST_ME_POFF)
doSendMagicEffect(playerB[i], CONST_ME_ENERGYAREA)
end
else
for x = from.x, to.x do
for y = from.y, to.y do
local v = getTopCreature({x=x, y=y, z=from.z}).uid
if v ~= 0 and isPlayer(v) then
return doPlayerSendCancel(cid, 'There is already a team in the quest room.')
end
end
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
Last edited: