Forum poświęcone powstawaniu Belxena OTS
function onUse(cid, item, frompos, item2, topos)
local level = 20 --wymagany lvl
local found = 0 --koniecznie na 0! Zabiezpieczy to teleportowaniu np polowy graczy. A z reszta nie wazne... Nie ruszaj =]
local pos = {
spellbook = {x=435, y=404, z=9, stackpos=1},
crossbow = {x=443, y=404, z=9, stackpos=1},
apple = {x=430, y=404, z=9, stackpos=1},
sword = {x=439, y=404, z=9, stackpos=1}}
local id = {
spellbook = 2175,
crossbow = 2455,
apple = 2674,
sword = 2376}
local pPos = {
sorcerer = {x=435, y=405, z=9, stackpos=253},
paladin = {x=443, y=405, z=9, stackpos=253},
druid = {x=430, y=405, z=9, stackpos=253},
knight = {x=439, y=405, z=9, stackpos=253}}
local npos = {
sorcerer = {x=443, y=396, z=9},
paladin = {x=443, y=396, z=9},
druid = {x=436, y=396, z=9},
knight = {x=436, y=396, z=9}}
for i = 1, 4 do
if getThingfromPos(pos[i]).itemid == id[i] then
if getPlayerLevel(getThingfromPos(pPos[i])) >= level then --ta funkcja sprawdza nie tylko level graczy, ale tez czy gracz znajduje sie na pozycji
found = found + 1
else
doPlayerSendCancel(cid,"Musisz miec 4 graczy z levelem powyzej 20!")
break
end
else
doPlayerSendCancel(cid,"Musisz polozyc odpowiednie itemy na odpowiednich pozycjach!")
break
end
end
if found == 4 then
for xd = 1, 4 do
doTeleportThing(getThingfromPos(pPos[i]),npos[i])
doSendMagicEffect(npos[i],12)
end
end
return 1
end
Offline