chojrak
Banned User
- Joined
- Oct 25, 2008
- Messages
- 5,832
- Solutions
- 2
- Reaction score
- 160
I don't know why, but when i saw this thread: http://otland.net/f81/might-good-someone-desert-quest-easy-configure-48895/. I decide to write my own, maybe i don't like Ezzam's code (no loops etc.) xD
Code is untested but shuold work:
Code is untested but shuold work:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Positions/ID's/Vocations order: paladin, sorcerer, knight, druid.
local positions = {
players = {
{x = 100, y = 100, z = 7, stackpos = 253},
{x = 100, y = 100, z = 7, stackpos = 253},
{x = 100, y = 100, z = 7, stackpos = 253},
{x = 100, y = 100, z = 7, stackpos = 253}
}
items = {
{x = 100, y = 100, z = 7, stackpos = 2},
{x = 100, y = 100, z = 7, stackpos = 2},
{x = 100, y = 100, z = 7, stackpos = 2},
{x = 100, y = 100, z = 7, stackpos = 2}
}
new = {
{x = 100, y = 100, z = 7},
{x = 100, y = 100, z = 7},
{x = 100, y = 100, z = 7},
{x = 100, y = 100, z = 7}
}
}
local vocations = {3, 1, 4, 2}
local items = {2455, 2376, 2674, 2175}
-- don't touch below.
local check = {
players = true,
vocations = true,
items = true
}
if (item.itemid == 1945) then
for i = 1, 4 do
if (not isPlayer(getThingFromPos(positions.players[i]).uid)) then
doPlayerSendCancel(cid, "You need 4 players.")
check.players = false
break
end
end
for i = 1, 4 do
if (getPlayerVocation(getThingFromPos(positions.players[i]).uid) ~= vocations[i]) then
doPlayerSendCancel(cid, "Wrong vocations.")
check.vocations = false
break
end
end
for i = 1, 4 do
if (getThingFromPos(positions.items[i]).itemid ~= items[i]) then
doPlayerSendCancel(cid, "Wrong items.")
check.items = false
break
end
end
if (check.players and check.vocations and check.items) then
for i = 1, 4 do
doTeleportThing(getThingFromPos(positions.players[i]).uid, positions.new[i])
doSendMagicEffect(positions.players[i], CONST_ME_POFF)
doSendMagicEffect(positions.new[i], CONST_ME_TELEPORT)
doTransformItem(item.uid, item.itemid + 1)
end
end
elseif (item.itemid == 1946) then
doTransformItem(item.uid, item.itemid - 1)
end
return TRUE
end
Last edited: