Erevius
It Was A Good Day
I'm using Avesta 7.6 by Ferrus. The Door System installed with engine didn't work so I made a new one.
This is my MaxLVL, MinLVL, Voc, Premium door script:
For me it's looking fine but:
Can someone repair this script or give me some instructions?
This is my MaxLVL, MinLVL, Voc, Premium door script:
Code:
-- by Erevius!!!
-- ActionIDs:
-- 1001~1999: Level doors(level is actionID-1000)
-- 2001~2999: Level doors for low levels(level is actionID-1000)
-- 3001~3008: Vocation doors(voc is ActionID-2000. 1:Sorcerer, 2:Druid, 3:Paladin, 4:Knight, 5:MS, 6:ED, 7:RP, 8:EK)
function onUse(cid, item, frompos, pos, item2, topos)
local isminLevelDoor = (item.actionid >= 1001 and item.actionid <= 1999)
local ismaxLevelDoor = (item.actionid >= 2001 and item.actionid <= 2999)
local isVocationDoor = (item.actionid >= 3001 and item.actionid <= 3008)
local isPremmyDoor = (item.actionid == 4000)
-- Positions --
pos0 = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253}
pos1 = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253}
pos2 = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253}
pos3 = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253}
pos4 = {x=frompos.x+1, y=frompos.y-1, z=frompos.z, stackpos=253}
pos5 = {x=frompos.x-1, y=frompos.y-1, z=frompos.z, stackpos=253}
pos6 = {x=frompos.x+1, y=frompos.y+1, z=frompos.z, stackpos=253}
pos7 = {x=frompos.x-1, y=frompos.y+1, z=frompos.z, stackpos=253}
-- Normal Door --
if not(isminLevelDoor or ismaxLevelDoor or isVocationDoor) then
doTransformItem(item.uid, item.itemid+1)
end
-- Minimum Level Doors --
minpasslevel = (item.actionid - 1000)
if (isminLevelDoor) then
if (getPlayerLevel(cid) >= minpasslevel) then
if (getPlayerPosition(uid) == pos0) then
doMoveCreature(cid, 0)
elseif (getPlayerPosition(uid) == pos1) then
doMoveCreature(cid, 1)
elseif (getPlayerPosition(uid) == pos2) then
doMoveCreature(cid, 2)
elseif (getPlayerPosition(uid) == pos3) then
doMoveCreature(cid, 3)
elseif (getPlayerPosition(uid) == pos4) then
doMoveCreature(cid, 4)
elseif (getPlayerPosition(uid) == pos5) then
doMoveCreature(cid, 5)
elseif (getPlayerPosition(uid) == pos6) then
doMoveCreature(cid, 6)
elseif (getPlayerPosition(uid) == pos7) then
doMoveCreature(cid, 7)
end
doTransformItem(item.uid, item.itemid+1)
else
doPlayerSendTextMessage(cid,22,'You need level ' .. minpasslevel .. ' to pass this door.')
end
end
-- Maximum Level Doors --
maxpasslevel = (item.actionid - 2000)
if (ismaxLevelDoor) then
if (getPlayerLevel(cid) <= maxpasslevel) then
if (getPlayerPosition(uid) == pos0) then
doMoveCreature(cid, 0)
elseif (getPlayerPosition(uid) == pos1) then
doMoveCreature(cid, 1)
elseif (getPlayerPosition(uid) == pos2) then
doMoveCreature(cid, 2)
elseif (getPlayerPosition(uid) == pos3) then
doMoveCreature(cid, 3)
elseif (getPlayerPosition(uid) == pos4) then
doMoveCreature(cid, 4)
elseif (getPlayerPosition(uid) == pos5) then
doMoveCreature(cid, 5)
elseif (getPlayerPosition(uid) == pos6) then
doMoveCreature(cid, 6)
elseif (getPlayerPosition(uid) == pos7) then
doMoveCreature(cid, 7)
end
doTransformItem(item.uid, item.itemid+1)
else
doPlayerSendTextMessage(cid,22,'You need level ' .. maxpasslevel .. ' and below to pass this door.')
end
end
-- Vocation Doors --
playervoc = getPlayerVocation(cid)
allowedvoc = (item.actionid - 3000)
if (isVocationDoor) then
if (playervoc(cid) == (allowedvoc or (allowedvoc + 4))) then
if (getPlayerPosition(uid) == pos0) then
doMoveCreature(cid, 0)
elseif (getPlayerPosition(uid) == pos1) then
doMoveCreature(cid, 1)
elseif (getPlayerPosition(uid) == pos2) then
doMoveCreature(cid, 2)
elseif (getPlayerPosition(uid) == pos3) then
doMoveCreature(cid, 3)
elseif (getPlayerPosition(uid) == pos4) then
doMoveCreature(cid, 4)
elseif (getPlayerPosition(uid) == pos5) then
doMoveCreature(cid, 5)
elseif (getPlayerPosition(uid) == pos6) then
doMoveCreature(cid, 6)
elseif (getPlayerPosition(uid) == pos7) then
doMoveCreature(cid, 7)
end
doTransformItem(item.uid, item.itemid+1)
else
doPlayerSendTextMessage(cid,22,'You vocation is not allowed to pass this door.')
end
end
-- Premium Doors --
if (isPremmyDoor) then
if (isPremium == true) then
if (getPlayerPosition(uid) == pos0) then
doMoveCreature(cid, 0)
elseif (getPlayerPosition(uid) == pos1) then
doMoveCreature(cid, 1)
elseif (getPlayerPosition(uid) == pos2) then
doMoveCreature(cid, 2)
elseif (getPlayerPosition(uid) == pos3) then
doMoveCreature(cid, 3)
elseif (getPlayerPosition(uid) == pos4) then
doMoveCreature(cid, 4)
elseif (getPlayerPosition(uid) == pos5) then
doMoveCreature(cid, 5)
elseif (getPlayerPosition(uid) == pos6) then
doMoveCreature(cid, 6)
elseif (getPlayerPosition(uid) == pos7) then
doMoveCreature(cid, 7)
end
doTransformItem(item.uid, item.itemid+1)
else
doPlayerSendTextMessage(cid,22,'You need a premium account to pass this door.')
end
end
return TRUE
end
For me it's looking fine but:
Can someone repair this script or give me some instructions?