Ir para conteúdo

Featured Replies

Postado

Olá, eu estou tentando corrigir este script, ai vai as situações...

o local AUTO_CLOSE_DOOR_ACTION_IDS Estão de ordem organizada, na vertical, mas acho que algo esta errado ai... pois na hora do bem bom, o script não funciona, se eu deixar apenas um local AUTO_CLOSE_DOOR_ACTION_IDS funciona perfeitamente, poderia me ajudar?

Legenda exemplar: 8010,8010 = Porta Action ID + Chave action ID.

 

local AUTO_CLOSE_DOOR_ACTION_IDS = {8010, 8010} -- Porta da antiga Chain Armor
local AUTO_CLOSE_DOOR_ACTION_IDS = {8020, 8020} -- Porta depois de matar o Meat Eater, que aparece la no barco
local AUTO_CLOSE_DOOR_ACTION_IDS = {8080, 8080} -- Porta da vocacao Rook Guardian
local AUTO_CLOSE_DOOR_ACTION_IDS = {8040, 8040} -- Portas das escolha de classe
local AUTO_CLOSE_DOOR_ACTION_IDS = {8050, 8050} -- Portas das escolha de classe
local AUTO_CLOSE_DOOR_ACTION_IDS = {8060, 8060} -- Portas das escolha de classe
local AUTO_CLOSE_DOOR_ACTION_IDS = {8070, 8070} -- Portas das escolha de classe
local CLOSE_DELAY = 2 * 1000 -- the auto close delay 2 * 1000 = 2 sec
local function closeDoor(doorPos, toItemid)
    local door = getTileItemByType(doorPos, ITEM_TYPE_DOOR)
    if door ~= nil then
        if isInArray(verticalOpenDoors, toItemid) then
            doRelocate(doorPos, {x=doorPos.x, y=doorPos.y+1, z=doorPos.z})
        else
            doRelocate(doorPos, {x=doorPos.x+1, y=doorPos.y, z=doorPos.z})
        end
        doTransformItem(door.uid, toItemid)
    end
end
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

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getItemLevelDoor(item.itemid) > 0) then
		if(item.actionid == 189) then
			if(isPremium(cid) ~= TRUE) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao possui o nivel necessario para passar.")
				return TRUE
			end

			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
			return TRUE
		end

		local gender = item.actionid - 186
		if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE, PLAYERSEX_GAMEMASTER}, gender) == TRUE) then
			local playerGender = getPlayerSex(cid)
			if(playerGender ~= gender) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao possui o nivel necessario para passar.")
				return TRUE
			end

			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
			return TRUE
		end

		local skull = item.actionid - 180
		if(skull >= 0 and skull < 6) then
			local playerSkull = getCreatureSkullType(cid)
			if(playerSkull ~= skull) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao possui o nivel necessario para passar.")
				return TRUE
			end

			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
			return TRUE
		end

		local group = item.actionid - 150
		if(group >= 0 and group < 30) then
			local playerGroup = getPlayerGroupId(cid)
			if(playerGroup < group) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao possui o nivel necessario para passar.")
				return TRUE
			end

			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
			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, "Voce nao possui o nivel necessario para passar.")
				return TRUE
			end

			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
			return TRUE
		end

		if(item.actionid == 190 or (item.actionid ~= 0 and getPlayerLevel(cid) >= (item.actionid - getItemLevelDoor(item.itemid)))) then
			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao possui o nivel necessario para passar.")
		        end
        return TRUE
    elseif isInArray(keys, item.itemid) == TRUE then
        if itemEx.actionid > 0 then
            if item.actionid == itemEx.actionid then
                if doors[itemEx.itemid] ~= nil then
                    doTransformItem(itemEx.uid, doors[itemEx.itemid])
                   
                    if isInArray(AUTO_CLOSE_DOOR_ACTION_IDS, itemEx.actionid) then
                        addEvent(closeDoor, CLOSE_DELAY, toPosition, itemEx.itemid)
                        doRemoveItem(item.uid, 1)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "A Chave emperrou dentro da fechadura, mas possibilitou voce passar.")
                    end
                               
                    return TRUE
                end
            end
            doPlayerSendCancel(cid, "A Chave nao corresponde ao buraco da fechadura.")
            return TRUE
        end
        return FALSE
    elseif isInArray(horizontalOpenDoors, item.itemid) == TRUE 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
            if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
                doPlayerSendCancel(cid, "Sorry, not possible.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
    elseif isInArray(verticalOpenDoors, item.itemid) == TRUE 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 getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
                doPlayerSendCancel(cid, "Sorry, not possible.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
    elseif doors[item.itemid] ~= nil then
        if item.actionid == 0 then
            doTransformItem(item.uid, doors[item.itemid])
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Esta trancada, procure pela chave.")
        end
        return TRUE
    end
    return FALSE
end

 

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo