Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado
6 minutos atrás, IceWar disse:

O script continua não contando as mortes mano :( Fiz o teste aqui, atacando com 1 player ou com 2, ele não conta as mortes, sempre [1].

 

registrou o evento no onLogin?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

  • Respostas 16
  • Visualizações 960
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

Registrei sim mano, substitui certinho mas mesmo assim não tive sucesso. A unica solução que encontrei mesmo foi fazer contabilizar as kills de forma individual. Fiz um script que conseguiu contabilizar as kills por player, e não pelo time, aí deu certo :(.

Vou deixar o meu script que deu certo aqui, se vc achar melhor implementar a ideia nele (de contar as kills tanto por players quanto por equipes) ficaria interessante também, pros players terem uma espécie de frags dentro do evento...

 

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)
dofile('data/lib/EventPoints.lua')

local storageIdGreen = 10001
local storageIdRed = 10002

-- apenas para rapida alteracao de quantidade de kills para acabar o evento, a titulo de testes.
local eventconfigs = {
	narrow = 3,
	constante = 1
}

local config = {
	pos_rock_green = {x=489, y=281, z=7, stackpos=1},
	pos_TP_green = {x=488, y=278, z=7, stackpos=1},
	pos_rock_red = {x=479, y=278, z=7, stackpos=1},
	pos_TP_red = {x=477, y=281, z=7, stackpos=1},
	townid = 13
}

if isPlayer(cid) then
			if getPlayerStorageValue(cid, storageIdRed) == 1 then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deu ponto para a equipe adversaria ! Voce possui : ["..getPlayerStorageValue(cid, eventconfig.GSR).."] pontos.")
						setPlayerStorageValue(deathList[1], eventconfig.GSG, getPlayerStorageValue(deathList[1], eventconfig.GSG) + eventconfigs.constante)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O(a) "..getCreatureName(deathList[1]).." possui um total de: ["..getPlayerStorageValue(deathList[1], eventconfig.GSG).."] pontos.")		
			end
			if getPlayerStorageValue(cid, storageIdGreen) == 1 then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deu ponto para a equipe adversaria ! Voce possui : ["..getPlayerStorageValue(cid, eventconfig.GSG).."] pontos.")
						setPlayerStorageValue(deathList[1], eventconfig.GSR, getPlayerStorageValue(deathList[1], eventconfig.GSR) + eventconfigs.constante)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O(a) "..getCreatureName(deathList[1]).." possui um total de: ["..getPlayerStorageValue(deathList[1], eventconfig.GSR).."] pontos.")
			end			

-- fim do evento
	if getPlayerStorageValue(deathList[1], eventconfig.GSR) >= eventconfigs.narrow or getPlayerStorageValue(deathList[1], eventconfig.GSG) >= eventconfigs.narrow then
			--criar as rocks para evitar players de entrarem no evento instantaneamente e confundirem o GM
			doCreateItem(1285,1,config.pos_rock_green)
			doCreateItem(1285,1,config.pos_TP_green)
			doCreateItem(1285,1,config.pos_rock_red)
			doCreateItem(1285,1,config.pos_TP_red)

			if getPlayerStorageValue(deathList[1], storageIdRed) == 1 then
				doBroadcastMessage("{RED TEAM} é o vencedor do evento ! Total: ["..eventconfigs.narrow.."] Kills !", 25)
			end

			
			if getPlayerStorageValue(deathList[1], storageIdGreen) == 1 then
				doBroadcastMessage("{GREEN TEAM} é o vencedor do evento ! Total: ["..eventconfigs.narrow.."] Kills !", 25)
			end
				for _, cid in ipairs(getPlayersOnline()) do
					if getPlayerStorageValue(deathList[1], storageIdRed) == 1 or getPlayerStorageValue(deathList[1], storageIdGreen) == 1 then
						if getPlayerStorageValue(cid, storageIdRed) == 1 or getPlayerStorageValue(cid, storageIdGreen) == 1 then
							doTeleportThing(cid, getTownTemplePosition(config.townid))
								if getPlayerStorageValue(cid, eventconfig.GSG) ~= 0 or getPlayerStorageValue(deathList[1], eventconfig.GSG) ~= 0 then
									setPlayerStorageValue(cid, eventconfig.GSG, 0)
									setPlayerStorageValue(deathList[1], eventconfig.GSG, 0)
								end
								if getPlayerStorageValue(cid, eventconfig.GSR) ~= 0 or getPlayerStorageValue(deathList[1], eventconfig.GSR) ~= 0 then
									setPlayerStorageValue(cid, eventconfig.GSR, 0)
									setPlayerStorageValue(deathList[1], eventconfig.GSR, 0)
								end
						end
					end
				end
	end
end

return true
end

 

Baiak 24h -> www.baiakinfinity.ml

Postado
  • Autor

Ok, vou postar os 3 códigos que precisei usar: as libs, o creaturescripts do onpreparedeath e onkill.

 

EventPoints.lua - libs:

eventconfig = {
	GSR = 10400,
	GSG = 10600,
	narrow = 3
}

 

Creaturescripts/scripts/Event_Dead.lua:

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)
dofile('data/lib/EventPoints.lua')

local storageIdGreen = 10001
local storageIdRed = 10002

-- apenas para rapida alteracao de quantidade de kills para acabar o evento, a titulo de testes.
local eventconfigs = {
	narrow = 3,
	constante = 1
}

local config = {
	pos_rock_green = {x=489, y=281, z=7, stackpos=1},
	pos_TP_green = {x=488, y=278, z=7, stackpos=1},
	pos_rock_red = {x=479, y=278, z=7, stackpos=1},
	pos_TP_red = {x=477, y=281, z=7, stackpos=1},
	townid = 13
}

if isPlayer(cid) then
			if getPlayerStorageValue(cid, storageIdRed) == 1 then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deu ponto para a equipe adversaria ! Voce possui : ["..getPlayerStorageValue(cid, eventconfig.GSR).."] pontos.")
						setPlayerStorageValue(deathList[1], eventconfig.GSG, getPlayerStorageValue(deathList[1], eventconfig.GSG) + eventconfigs.constante)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O(a) "..getCreatureName(deathList[1]).." possui um total de: ["..getPlayerStorageValue(deathList[1], eventconfig.GSG).."] pontos.")		
			end
			if getPlayerStorageValue(cid, storageIdGreen) == 1 then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deu ponto para a equipe adversaria ! Voce possui : ["..getPlayerStorageValue(cid, eventconfig.GSG).."] pontos.")
						setPlayerStorageValue(deathList[1], eventconfig.GSR, getPlayerStorageValue(deathList[1], eventconfig.GSR) + eventconfigs.constante)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O(a) "..getCreatureName(deathList[1]).." possui um total de: ["..getPlayerStorageValue(deathList[1], eventconfig.GSR).."] pontos.")
			end			

-- fim do evento
	if getPlayerStorageValue(deathList[1], eventconfig.GSR) >= eventconfigs.narrow or getPlayerStorageValue(deathList[1], eventconfig.GSG) >= eventconfigs.narrow then
			--criar as rocks para evitar players de entrarem no evento instantaneamente e confundirem o GM
			doCreateItem(1285,1,config.pos_rock_green)
			doCreateItem(1285,1,config.pos_TP_green)
			doCreateItem(1285,1,config.pos_rock_red)
			doCreateItem(1285,1,config.pos_TP_red)

			if getPlayerStorageValue(deathList[1], storageIdRed) == 1 then
				doBroadcastMessage("{RED TEAM} é o vencedor do evento ! Total: ["..eventconfigs.narrow.."] Kills !", 25)
			end

			
			if getPlayerStorageValue(deathList[1], storageIdGreen) == 1 then
				doBroadcastMessage("{GREEN TEAM} é o vencedor do evento ! Total: ["..eventconfigs.narrow.."] Kills !", 25)
			end
				for _, cid in ipairs(getPlayersOnline()) do
					if getPlayerStorageValue(deathList[1], storageIdRed) == 1 or getPlayerStorageValue(deathList[1], storageIdGreen) == 1 then
						if getPlayerStorageValue(cid, storageIdRed) == 1 or getPlayerStorageValue(cid, storageIdGreen) == 1 then
							doTeleportThing(cid, getTownTemplePosition(config.townid))
								if getPlayerStorageValue(cid, eventconfig.GSG) ~= 0 or getPlayerStorageValue(deathList[1], eventconfig.GSG) ~= 0 then
									setPlayerStorageValue(cid, eventconfig.GSG, 0)
									setPlayerStorageValue(deathList[1], eventconfig.GSG, 0)
								end
								if getPlayerStorageValue(cid, eventconfig.GSR) ~= 0 or getPlayerStorageValue(deathList[1], eventconfig.GSR) ~= 0 then
									setPlayerStorageValue(cid, eventconfig.GSR, 0)
									setPlayerStorageValue(deathList[1], eventconfig.GSR, 0)
								end
						end
					end
				end
	end
end

return true
end

 

Creaturescripts/scripts/eventkill.lua:

function onKill(cid, target)
dofile('data/lib/EventPoints.lua')

local green = 10001
local red = 10002
-- local GSR = 10400
-- local GSG = 10600

if isPlayer(cid) then
	if getPlayerStorageValue(cid, red) == 1 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu time recebeu ponto ! Voce possui: ["..getPlayerStorageValue(cid, eventconfig.GSR).."] kills.")		
	end
	
	if getPlayerStorageValue(cid, green) == 1 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu time recebeu ponto ! Voce possui: ["..getPlayerStorageValue(cid, eventconfig.GSG).."] kills.")
	end
end

return true
end

prontinho !

Baiak 24h -> www.baiakinfinity.ml

Postado
<event type="PrepareDeath" name="EventDeath" event="script" value="nome do seu script.lua"/>

 

no login.lua adc

 

registerCreatureEvent(cid, "EventDeath")

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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