Ir para conteúdo

(Resolvido)Quando alguem mata outra pessoa aparece no broadcast

Featured Replies

Postado

Eae glr td bem ! Eu quero 2 script , um que quando alguem mata um player mostra no broadcast assim : XPLAYER assasinou XPLAYER,e se o PK morreu, aparece XPLAYER matou XPLAYER.

 

E o outro script é de um monster, que chama Policial, que ele mata os PK que aparecer na tela

Atenciosamente, Anuudek.

                                                               banner.gif

Resolvido por ViitinG

Ir para solução
  • Respostas 11
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tente esse para o Policial : Em "data/npc/lib", crie um arquivo chamado "guard.lua" e adicione o conteúdo abaixo: Guard = { config = { attackspeed = 1000, }, combat = {type = COMBAT_PHYSI

Postado
  • Solução

Tente esse para o Policial :

Em "data/npc/lib", crie um arquivo chamado "guard.lua" e adicione o conteúdo abaixo:

Guard = {
	config = {			  
		attackspeed = 1000,
	},
	combat = {type = COMBAT_PHYSICALDAMAGE, min = 100, max = 200}
}

function Guard:new()
		local ret = {}
		setmetatable({}, {__index = self.combat})
		setmetatable(ret, {__index = self})
		return ret
end

function Guard:reset()
	self.config = Guard.config
	self.target = 0
	selfFollow(0)
	doTeleportThing(self.id, self.position)
end


function Guard:updateTarget()
	if self.target ~= 0 then
		return
	end

	local creatures = getSpectators(getThingPosition(self.id), self.range, self.range, false)
	for i = 1, #creatures do
		local target = creatures[i]
		if isCreature(target) and not isNpc(target) and getCreatureSkull(target) >= 3 then
			if not getTilePzInfo(getThingPosition(target)) then
				if selfFollow(target) then
					selfSay("I don't tolerate people like you, ".. getCreatureName(target))
					self.target = target
					self:attack()
					break
				end
			end
		else
			self:reset()
		end
	end
end

function Guard:attack()
	if self.target == 0 then
		self:reset()
		return
	end

	self.time = self.time or os.clock()
	if self.time < os.clock() then
		if getDistanceBetween(getThingPosition(self.id), getThingPosition(self.target)) == 1 then
			doTargetCombatHealth(self.id, self.target, self.combat.type, -self.combat.min, -self.combat.max, CONST_ME_DRAWBLOOD)
		end
		self.time = self.time + (self.config.attackspeed/1000)
	end
end

Agora em "data/npc/scripts", crie um arquivo chamado "guard.lua" e adicione o conteúdo abaixo:

local guard = Guard:new()

function onCreatureAppear(cid)
	if cid == getNpcId() then
		guard.id = getNpcId()
		guard.target = 0
		guard.position = getNpcPos()
	end
end

function onCreatureDisappear(cid)
	if cid == guard.target then
		guard:reset()
	end
end

function onCreatureSay(cid, type, msg)
	return false
end

function onThink()
	guard:updateTarget()
	if guard.target ~= 0 then
		if isCreature(guard.target) then
			guard:attack()
		else
			guard:reset()
		end
	else
		guard:reset()
	end
end

E em "data/npc/" crie um arquivo chamado "guard.xml" e adicione o conteúdo abaixo:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Policial" script="guard.lua" walkinterval="0" speed="200" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="57" body="59" legs="40" feet="76" addons="0"/>
	<parameters/>
</npc>

Ajudei REP +  :D 

Postado
  • Autor

Se funcionar do REP+ ! Já já edito !

 

@Edit

 

Não deu , quando vou sumonar ele aparece : Sorry not possible ! E no TFS aparece : 

[31/01/2014 17:56:29] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such table: shop_history (SELECT * FROM shop_history WHERE "processed" = 0;)
[31/01/2014 17:56:58] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/policial.xml).
[31/01/2014 17:56:58] Info: failed to load external entity "data/npc/policial.xml"

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

Atenciosamente, Anuudek.

                                                               banner.gif

Postado
  • Autor
[31/01/2014 18:30:26] [Error - Npc interface] 
[31/01/2014 18:30:26] data/npc/scripts/guard.lua
[31/01/2014 18:30:26] Description: 
[31/01/2014 18:30:26] data/npc/scripts/guard.lua:1: attempt to index global 'Guard' (a nil value)
[31/01/2014 18:30:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/guard.lua
 
@EDIT
Eu troquei o lib pelo o script e o script pelo lib e deu certo ! Tu postou errado... Mesmo assim te dou REP+

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

Atenciosamente, Anuudek.

                                                               banner.gif

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