Ir para conteúdo

Featured Replies

Postado

.Olá bom dia,

 

Gostaria de pedir uma ajuda a vocês, estou com o seguinte problema.

Quando tento abrir a porta da house comprado no !buyhouse a porta não se abre e não gera erro na distro.

Mesmo a house sendo minha conferido dando look na porta...

 

Já com as portas de leveis funciona normal...

Segue meu doors.lua em actions

Spoiler

local config = {
	maxLevel = getConfigInfo('maximumDoorLevel')
}

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 locked = DOORS[item.itemid]
	if(locked) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
		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, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local gender = item.aid - 186
		if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE}, gender)) then
			if(gender ~= getPlayerSex(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local skull = item.aid - 180
		if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
			if(skull ~= getCreatureSkullType(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local group = item.aid - 150
		if(group >= 0 and group < 30) then
			if(group > getPlayerGroupId(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		local vocation = item.aid - 100
		if(vocation >= 0 and vocation < 50) then
			local vocationEx = getVocationInfo(getPlayerVocation(cid))
			if(vocationEx.id ~= vocation and vocationEx.fromVocation ~= vocation) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
				return true
			end

			doTeleportThing(cid, toPosition)
			return false
		end

		if(item.aid == 190 or (item.aid >= 1000 and (item.aid - door.levelDoor) <= config.maxLevel and getPlayerLevel(cid) >= (item.aid - door.levelDoor))) then
			doTeleportThing(cid, toPosition)
			return false
		end

		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
		return true
	end

	if(door.specialDoor) then
		if(item.aid == 100 or (item.aid ~= 0 and getCreatureStorage(cid, item.aid) ~= EMPTY_STORAGE)) then
			doTeleportThing(cid, toPosition)
			return false
		end

		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
		return true
	end

	if(getTileInfo(toPosition).creatures > 0) then -- check only if there are any creatures
		local position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = STACKPOS_TOP_CREATURE}
		position.x = position.x + 1

		local query = doTileQueryAdd(cid, position, 20)
		if(query == RETURNVALUE_NOTPOSSIBLE) then
			position.x = position.x - 1
			position.y = position.y + 1
			query = doTileQueryAdd(cid, position, 20)
		end

		if(query ~= RETURNVALUE_NOERROR) then
			doPlayerSendDefaultCancel(cid, query)
			return true
		end

		toPosition.stackpos = STACKPOS_TOP_CREATURE
		while(true) do
			local thing = getThingFromPosition(toPosition)
			if(thing.uid == 0) then
				break
			end

			doTeleportThing(thing.uid, position)
			return false
		end
	end

	local field = getTileItemByType(toPosition, ITEM_TYPE_MAGICFIELD)
	if(field.uid ~= 0) then
		doRemoveItem(field.uid)
	end

	return door.closingDoor
end

 

 

Segue meu closingdoors.lua em movements

Spoiler

function onStepOut(cid, item, position, fromPosition)
    local newPosition = {x = position.x, y = position.y, z = position.z}
    if isInArray(verticalOpenDoors, item.itemid) == TRUE then
        newPosition.x = newPosition.x + 1
    else
        newPosition.y = newPosition.y + 1
    end



    local tmpPos = {x = position.x, y = position.y, z = position.z, stackpos = -1}
    local tileCount = getTileThingByPos(tmpPos)
    local i = 1
    local tmpItem = {uid = 1}
    while(tmpItem.uid ~= 0 and i < tileCount) do
        tmpPos.stackpos = i
    tmpItem = getTileThingByPos(tmpPos)
    if tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid) == TRUE then
        doRemoveItem(tmpItem.uid)
    else
        i = i + 1
        end
    end
    doTransformItem(item.uid, item.itemid - 1)
    return TRUE
end

 

Utilizo TFS 0.4 - 8.60

Agradeço desde já

Resolvido por Myalitth

Ir para solução
Postado
  • Autor
Em 31/12/2021 em 14:59, Myalitth disse:

O problema esta na talkaction !buyhouse, tenta alterar ela por outras compativeis com seu distro.

Não está, !buyhouse chama função direto da distro "houseBuy". Já troquei a distro e nada...

Troquei também o comando talkaction e problema continua..

Postado

Antes de tudo faça os seguintes testes e me de um retorno, se possivel bem detalhado

 

  1. Com o God mova o player(dono) pra dentro da house e vê se ele consegue andar livremente
  2. Crie essa mesma porta que está utilizando na house e veja se ela abre normal sem nenhum atributo setada nela(ops, vi que você disse que funciona. ignore este)
  3. No seu mapa editor verifique se os pisos das casas estão selecionados corretos(geralmente ficam com a cor roxa/azul). Não esqueça de conferir se o piso de baixo da porta também está OK.
  4. Qual REV da TFS 0.4 está utilizando? testou com outra?...
  5. Tente substituir seus scripts citados por este:

doors.lua:

Spoiler

local function checkStackpos(item, position)
	position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
	local thing = getThingFromPos(position)

	position.stackpos = STACKPOS_TOP_FIELD
	local field = getThingFromPos(position)

	return (item.uid == thing.uid or thing.itemid < 100 or field.itemid == 0)
end

local function doorEnter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
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

	if(getItemLevelDoor(item.itemid) > 0) then
		if(item.actionid == 189) then
			if(not isPremium(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local gender = item.actionid - 186
		if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE, PLAYERSEX_GAMEMASTER}, gender)) then
			if(gender ~= getPlayerSex(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local skull = item.actionid - 180
		if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
			if(skull ~= getCreatureSkullType(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local group = item.actionid - 150
		if(group >= 0 and group < 30) then
			if(group > getPlayerGroupId(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local vocation = item.actionid - 100
		if(vocation >= 0 and vocation < 50) then
			local playerVocationInfo = getVocationInfo(getPlayerVocation(cid))
			if(playerVocationInfo.id ~= vocation and playerVocationInfo.fromVocation ~= vocation) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		if(item.actionid == 190 or (item.actionid ~= 0 and getPlayerLevel(cid) >= (item.actionid - getItemLevelDoor(item.itemid)))) then
			doorEnter(cid, item, toPosition)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
		end

		return true
	end

	if(isInArray(specialDoors, item.itemid)) then
		if(item.actionid == 100 or (item.actionid ~= 0 and getPlayerStorageValue(cid, item.actionid) > 0)) then
			doorEnter(cid, item, toPosition)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
		end

		return true
	end

	if(isInArray(keys, item.itemid)) then
		if(itemEx.actionid > 0) then
			if(item.actionid == itemEx.actionid and doors[itemEx.itemid] ~= nil) then
				doTransformItem(itemEx.uid, doors[itemEx.itemid])
				return true
			end

			doPlayerSendCancel(cid, "The key does not match.")
			return true
		end

		return false
	end

	if(isInArray(horizontalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then
		local newPosition = toPosition
		newPosition.y = newPosition.y + 1
		local doorPosition = fromPosition
		doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
		local doorCreature = getThingfromPos(doorPosition)
		if(doorCreature.itemid ~= 0) then
			local pzDoorPosition = getTileInfo(doorPosition).protection
			local pzNewPosition = getTileInfo(newPosition).protection
			if((pzDoorPosition and not pzNewPosition and doorCreature.uid ~= cid) or
				(not pzDoorPosition and pzNewPosition and doorCreature.uid == cid and isPlayerPzLocked(cid))) then
				doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			else
				doTeleportThing(doorCreature.uid, newPosition)
				if(not isInArray(closingDoors, item.itemid)) then
					doTransformItem(item.uid, item.itemid - 1)
				end
			end

			return true
		end

		doTransformItem(item.uid, item.itemid - 1)
		return true
	end

	if(isInArray(verticalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then
		local newPosition = toPosition
		newPosition.x = newPosition.x + 1
		local doorPosition = fromPosition
		doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
		local doorCreature = getThingfromPos(doorPosition)
		if(doorCreature.itemid ~= 0) then
			if(getTileInfo(doorPosition).protection and not getTileInfo(newPosition).protection and doorCreature.uid ~= cid) then
				doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			else
				doTeleportThing(doorCreature.uid, newPosition)
				if(not isInArray(closingDoors, item.itemid)) then
					doTransformItem(item.uid, item.itemid - 1)
				end
			end

			return true
		end

		doTransformItem(item.uid, item.itemid - 1)
		return true
	end

	if(doors[item.itemid] ~= nil and checkStackpos(item, fromPosition)) then
		if(item.actionid == 0) then
			doTransformItem(item.uid, doors[item.itemid])
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
		end

		return true
	end

	return false
end

 

closingdoor.lua:

Spoiler

function onStepOut(cid, item, position, fromPosition)
	local newPosition = {x = position.x, y = position.y, z = position.z}
	if(isInArray(verticalOpenDoors, item.itemid)) then
		newPosition.x = newPosition.x + 1
	else
		newPosition.y = newPosition.y + 1
	end

	doRelocate(position, newPosition)
	local tmpPos = {x = position.x, y = position.y, z = position.z, stackpos = -1}
	local tileCount = getTileThingByPos(tmpPos)

	local i = 1
	local tmpItem = {uid = 1}
	while(tmpItem.uid ~= 0 and i < tileCount) do
		tmpPos.stackpos = i
		tmpItem = getTileThingByPos(tmpPos)
		if(tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid)) then
			doRemoveItem(tmpItem.uid)
		else
			i = i + 1
		end
	end

	doTransformItem(item.uid, item.itemid - 1)
	return true
end

 

 

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo