Ir para conteúdo
  • Cadastre-se

(Resolvido)(PEDIDO) Adicionar limitação ao comando /goto, /c


Ir para solução Resolvido por Cjaker,

Posts Recomendados

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

 

Link para o post
Compartilhar em outros sites

@SouDeus Mano Se for dar umas respostas dessa e melhor ficar queto não acha ?

@Andreeyyy Testei não mano adicionei a função de vem quais são as restrições :)  Bom aproveito!

/goto

function onSay(cid, words, param)
local restricao = {"Demon","Fire Devil"}
if param == "restricao"
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, restricao[r]")
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode usar isto diga /goto restricao")
end
end

/c

function onSay(player, words, param)

local restricao = {"Demon","Fire Devil"}
if param == "restricao"
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, restricao[r]")
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode usar isto diga /c restricao")
end
end

 

Editado por Ckfox (veja o histórico de edições)

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

Link para o post
Compartilhar em outros sites
6 horas atrás, Ckfox disse:

@SouDeus Mano Se for dar umas respostas dessa e melhor ficar queto não acha ?

@Andreeyyy Testei não mano adicionei a função de vem quais são as restrições :)  Bom aproveito!

/goto


function onSay(cid, words, param)
local restricao = {"Demon","Fire Devil"}
if param == "restricao"
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, restricao[r]")
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode usar isto diga /goto restricao")
end
end

/c


function onSay(player, words, param)

local restricao = {"Demon","Fire Devil"}
if param == "restricao"
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, restricao[r]")
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode usar isto diga /c restricao")
end
end

 

 

 

[Warning - Event::checkScript] Can not load script: scripts/teleport_to_creature.lua
data/talkactions/scripts/teleport_to_creature.lua:19: 'then' expected near 'doPlayerSendTextMessage'

TFS 1.2 - OTX

Link para o post
Compartilhar em outros sites

@Andreeyyy 

function onSay(cid, words, param)
local restricao = {"Demon","Fire Devil"}
if param == "restricao"
player:sendCancelMessage(restricao[r])
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
player:sendCancelMessage("Você não pode usar isto diga /goto restricao")
end
end
----------------------------------------------------------------------------------------

function onSay(player, words, param)

local restricao = {"Demon","Fire Devil"}
if param == "restricao"
player:sendCancelMessage(restricao[r])
return true
end

for r = 1, #restricao do
if param == restricao[r]then

	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
player:sendCancelMessage("Você não pode usar isto diga /c restricao")
end
end

 

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

Link para o post
Compartilhar em outros sites
  • Solução
Configs = {
	RestrictNames = {"gm fulano de tal"} -- lista de nomes proibidos para se usar /goto
}

local function tableContains(table, value)
	for index = 1, #table do
		if table[index]:lower() == value:lower() then
			return true
		end
	end
end

function onSay(cid, words, param)
	local player = Player(cid)
	if getPlayerGroupId(cid) > 3 then
		local target = Creature(param)
		if target == nil or tableContains(Configs.RestrictNames, player:getName()) then
			player:sendCancelMessage("Creature not found.")
			return false
		end
		
		player:teleportTo(target:getPosition())
		return false
	end
end
Configs = {
	RestrictNames = {"gm fulano de tal"}
}

local function tableContains(table, value)
	for index = 1, #table do
		if table[index]:lower() == value:lower() then
			return true
		end
	end
end

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

	local creature = Creature(param)
	if not creature or tableContains(Configs.RestrictNames, player:getName()) 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

 

ichigo.gif
https://github.com/Cjaker/

  , _ ,
 ( o o )
/'` ' `'\                     ESTOU TE OBSERVANDO O_O
|'''''''|
|\\'''//|
   """

 

Link para o post
Compartilhar em outros sites

@Ckfox 

[Warning - Event::checkScript] Can not load script: scripts/teleport_to_creature.lua
data/talkactions/scripts/teleport_to_creature.lua:19: 'then' expected near 'player'

@Cjaker 
Amor, não deu boa, ele continua aceitando o TP

Link para o post
Compartilhar em outros sites

@Andreeyyy 

function onSay(cid, words, param)
local restricao = {"Demon","Fire Devil"}

for r = 1, #restricao do
if param == restricao[r]then
player:sendCancelMessage("Você não pode usar isto diga /goto restricao")
return true
end

if param == "restricao" then
player:sendCancelMessage(restricao[r])
return true
end

	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
end
----------------------------------------------------------------------------------------

function onSay(player, words, param)

local restricao = {"Demon","Fire Devil"}

for r = 1, #restricao do
if param == restricao[r]then
player:sendCancelMessage("Você não pode usar isto diga /c restricao")
return true
end

if param == "restricao" then
player:sendCancelMessage(restricao[r])
return true
end
	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
end

 

Editado por Ckfox (veja o histórico de edições)

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

Link para o post
Compartilhar em outros sites

@Andreeyyy Eu tinha editado ele, você usou a mais recente ?

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo