Ir para conteúdo

Featured Replies

Resolvido por Dwarfer

Ir para solução
Postado

Se você fizer no seu servidor semelhante ao modo como esse mapa está:

 

Em actions/scripts crie um arquivo:

 

trainerlever.lua

 

Spoiler

local function isWalkable(cid, pos)
    pos.stackpos = 0
    if getTileThingByPos(pos).uid ~= 0 then
        local n = getTileInfo(pos)
        if n.protection == false and n.house == false and getTopCreature(pos).uid == 0 and doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then
            return true
        end
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i = -1, 1 do
        for j = -1, 1 do
            local train_pos = {x = toPosition.x + i, y = toPosition.y-j, z = toPosition.z}
            if isWalkable(cid, train_pos) then
                doTeleportThing(cid, train_pos)
                doSendMagicEffect(train_pos, CONST_ME_TELEPORT)
                return true
            end
        end
    end    
return doPlayerSendCancel(cid, "There is another player training.")
end

 

 

 

Em actions.xml, adicione a tag: <action actionid="ACTIONID_DA_ALAVANCA" script="trainerlever.lua" />

 

Contato:

 

  • 2 weeks later...
Postado
  • Solução

Sua versão de tfs era diferente.  O correto é esse:

 

Spoiler

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local isWalkable = function (position)
		local tile = Tile(position)
		if not tile then
			return false
		end
        
        if tile:getTopCreature() then
            return false
        end
        
		local ground = tile:getGround()
		if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then
			return false
		end
        	local items = tile:getItems()
		for i = 1, tile:getItemCount() do
			local item = items[i]
			local itemType = item:getType()
			if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then
				return false
			end
		end
        
		return true
	end

    for i = -1, 1 do
        for j = -1, 1 do
            local train_pos = Position(toPosition.x + i, toPosition.y - j, toPosition.z)
            if isWalkable(train_pos) then
                player:teleportTo(train_pos)
                train_pos:sendMagicEffect(CONST_ME_TELEPORT)
                return true
            end
        end
    end    
    return player:sendCancelMessage("There is another player training.")
end

 

 

Contato:

 

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.6k

Informação Importante

Confirmação de Termo