Ir para conteúdo

Script que impede player de passar pelo tile se estiver com determinado item

Featured Replies

Postado

Data/movements/movements.xml

Add a tag:

 

<movevent type="StepIn" actionid="666" event="script" value="verificar_item.lua"/>

actionid="666" ~ altere para o action ID que deseja utilizar, o qual deve botar no tile pelo map editor.

 

data/movements/scripts crie o arquivo verificar_item.lua

script:

function onStepIn(cid, item, position, fromPosition)
	
	local itemproibido = ID_DO_ITEM
	
	if not isPlayer(cid) then return true end
	if getPlayerItemCount(cid, itemproibido) >= 1 then
		doSendAnimatedText(getThingPos(cid), "[FAIL]", 187)
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao pode entrar aqui tendo ".. getItemNameById(itemproibido) .."!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED) 
		return true
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Boa viajem!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) 
		doSendAnimatedText(getThingPos(cid), "[OK]", 102)
		return true
	end
end

local itemproibido = ID_DO_ITEM coloque o ID do item que o script deve verificar.

 

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

Postado
  • Autor
  Em 08/07/2017 em 11:40, luangop disse:

Data/movements/movements.xml

Add a tag:

 

<movevent type="StepIn" actionid="666" event="script" value="verificar_item.lua"/>

actionid="666" ~ altere para o action ID que deseja utilizar, o qual deve botar no tile pelo map editor.

 

data/movements/scripts crie o arquivo verificar_item.lua

script:

function onStepIn(cid, item, position, fromPosition)
	
	local itemproibido = ID_DO_ITEM
	
	if not isPlayer(cid) then return true end
	if getPlayerItemCount(cid, itemproibido) >= 1 then
		doSendAnimatedText(getThingPos(cid), "[FAIL]", 187)
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao pode entrar aqui tendo ".. getItemNameById(itemproibido) .."!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED) 
		return true
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Boa viajem!")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN) 
		doSendAnimatedText(getThingPos(cid), "[OK]", 102)
		return true
	end
end

local itemproibido = ID_DO_ITEM coloque o ID do item que o script deve verificar.

 

Muito obrigado luangop! rep+

 

Host bom para hospedar seu jogo => https://shre.ink/OminiHost

 

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