redbull915
I learn...
I edit slaweska script arena to teleport a party members but i don't think is good write funkcjon for this but traing
This script:
I edit this, if when one player stand for corect postion don't get teleporet must be a minimal player 2 or more and must all player inparty
This script:
Lua:
local arenas = {
[6000] = {
fromPos ={
{x = 1151, y = 952, z = 9}, --player 1 start pos
{x = 1147, y = 952, z = 9} --player 2 start pos
{x = 1151, y = 952, z = 9}, --player 1 start pos
{x = 1147, y = 952, z = 9} --player 2 start pos
}, --you can add how much you want, there are no limits
toPos = {
{x = 1142, y = 934, z = 9}, --player 1 teleport position
{x = 1155, y = 934, z = 9} --player 2 teleport position
{x = 1142, y = 934, z = 9}, --player 1 teleport position
{x = 1155, y = 934, z = 9} --player 2 teleport position
} --you can add how much you want, there are no limits
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
doTransformItem(item.uid, 1945)
return TRUE
end
local arena = arenas[item.uid]
if(not arena) then
return FALSE
end
local players = {}
for _, pos in pairs(arena.fromPos) do
pos.stackpos = STACKPOS_TOP_CREATURE
local tmp = getThingfromPos(pos).uid
if(tmp > 0 and isCreature(tmp) == TRUE) then
table.insert(players, tmp)
end
end
if(table.maxn(players) < 2) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need more creatures for duel.")
return TRUE
end
if (getPartyMembers(players) >= 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You must be in a party!")
return TRUE
end
for i, pid in pairs(players) do
doSendMagicEffect(arena.fromPos[i], CONST_ME_POFF)
doTeleportThing(pid, arena.toPos[i])
doSendMagicEffect(arena.toPos[i], CONST_ME_TELEPORT)
end
return TRUE
end