Tipo do script: VIP Door.lua
Protocolo (versão do Tibia): 9.6
Servidor utilizado: The Forgotten Server
Nível de experiência: Iniciante
Adicionais/Informações:
Olá pessoal, meu nome é Caio, estou lançando um servidor novo, coloquei um sistema de VIP baseado na Premmium Account.
Até aí tudo bem, o problema real começou quando eu resolvi criar uma porta na qual somente VIPs (Premmium Accounts) possam acessar. Criei o seguinte script em actions/scripts:
local function doorEnter(cid, uid, id, position)
doTransformItem(uid, id)
doTeleportThing(cid, position)
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local door = getItemInfo(item.itemid)
if(door.levelDoor > 0) then
if(item.aid == 189) then
if(not isPremium(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Somente VIPs podem acessar essa area.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
end
if(door.specialDoor) then
if(item.aid == 100 or (item.aid ~= 0 and getCreatureStorage(cid, item.aid) > 0)) then
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
return true
end
toPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local fields, thing = getTileItemsByType(fromPosition, ITEM_TYPE_MAGICFIELD), getThingFromPosition(toPosition)
if(item.uid ~= thing.uid and thing.itemid >= 100 and table.maxn(fields) ~= 0) then
return true
end
local doorCreature = getThingFromPosition(toPosition)
if(doorCreature.itemid ~= 0) then
toPosition.x = toPosition.x + 1
local query = doTileQueryAdd(doorCreature.uid, toPosition, 20) -- allow to stack outside doors, but not on teleports or floor changing tiles
if(query == RETURNVALUE_NOTPOSSIBLE) then
toPosition.x = toPosition.x - 1
toPosition.y = toPosition.y + 1
query = doTileQueryAdd(doorCreature.uid, toPosition, 20) -- repeat until found
end
if(query ~= RETURNVALUE_NOERROR) then
doPlayerSendDefaultCancel(cid, query)
return true
end
doTeleportThing(doorCreature.uid, toPosition)
if(not door.closingDoor) then
doTransformItem(item.uid, door.transformUseTo)
end
return true
end
return false
end
em resposta eu criei a seguinte linha no actions.xml:
<action uniqueid="1948" event="script" value="vipdoor.lua"/>
até então o servidor conseguiu reconhecer o script (não apresentou nenhum erro quando rodei o servidor), mas a porta não funciona!!!
No Remere's eu coloquei o UniqueID na porta com o número 1948.
alguém sabe onde eu errei? Me ajudem por favor
estou anexando a imagem do que acontece quando se dá use na porta (já testei com personagens vips e não vips e a mensagem é a mesma)