Ir para conteúdo

Featured Replies

Postado

Existe uma maneira de limitar para que por exemplo o GM FULANO DE TAL, não possa dar /goto GM FULANINHO

Comando /goto
 

function onSay(cid, words, param)
	local player = Player(cid)
	if getPlayerGroupId(cid) > 3 then

	local target = Creature(param)
	if target == nil then
		player:sendCancelMessage("Creature not found.")
		return false
	end

	player:teleportTo(target:getPosition())
	return false
end
end

 

Comando /c

function onSay(player, words, param)
	if not player:getGroup():getAccess() then
		return true
	end

	local creature = Creature(param)
	if not creature then
		player:sendCancelMessage("A creature with that name could not be found.")
		return false
	end

	local oldPosition = creature:getPosition()
	local newPosition = creature:getClosestFreePosition(player:getPosition(), false)
	if newPosition.x == 0 then
		player:sendCancelMessage("You can not teleport " .. creature:getName() .. ".")
		return false
	elseif creature:teleportTo(newPosition) then
		if not creature:isInGhostMode() then
			oldPosition:sendMagicEffect(CONST_ME_POFF)
			newPosition:sendMagicEffect(CONST_ME_TELEPORT)
		end
	end
	return false
end

 

Postado

Comando /goto

 

Spoiler

dofile('data/lib/blockgotoandc.lua')

function onSay(player, words, param)
	if not player:getGroup():getAccess() then
		return true
	end

	local target = Creature(param)
	if target then
		local blockeds_to_player = blockeds[player:getName()]

		if blockeds_to_player ~= nil then
			if has_value(blockeds_to_player, target:getName()) then
				player:sendCancelMessage("You can't do it.")
				return false
			end
		end

		player:teleportTo(target:getPosition())
	else
		player:sendCancelMessage("Creature not found.")
	end
	return false
end

 

 

Comando /c

 

Spoiler

dofile('data/lib/blockgotoandc.lua')

function onSay(player, words, param)
	if not player:getGroup():getAccess() then
		return true
	end

	local creature = Creature(param)
	if not creature then
		player:sendCancelMessage("A creature with that name could not be found.")
		return false
	end

	local oldPosition = creature:getPosition()
	local newPosition = creature:getClosestFreePosition(player:getPosition(), false)
	if newPosition.x == 0 then
		player:sendCancelMessage("You can not teleport " .. creature:getName() .. ".")
		return false
	end

	local blockeds_to_player = blockeds[player:getName()]

	if blockeds_to_player ~= nil then
		if has_value(blockeds_to_player, creature:getName()) then
			player:sendCancelMessage("You can't do it.")
			return false
		end
	end

	if creature:teleportTo(newPosition) then
		if not creature:isInGhostMode() then
			oldPosition:sendMagicEffect(CONST_ME_POFF)
			newPosition:sendMagicEffect(CONST_ME_TELEPORT)
		end
	end
	return false
end

 

 

Crie um arquivo chamado blockgotoandc.lua dentro da pasta data/lib e configure os nomes.

 

Spoiler

blockeds = {
	['[GOD] Leohige'] = { -- Nome do player que utilizará o comando
		'Leohige'         -- Nome do player no qual não pode ser executado o comando
	}
}

function has_value(tab, val)
    for index, value in ipairs(tab) do
        if value == val then
            return true
        end
    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