Ir para conteúdo

Featured Replies

Postado

@JcA 

 

Mil perdões, entendi errado, entendi que você queria que o player não atacasse pessoas de qualquer time haha, a modificação correta seria trocar o return false do onPrepareDeath para return true. O correto ficará assim:

 

Spoiler

--[[
	<!-- DUCA Event -->
	<event type="login" name="Duca-Login" event="script" value="DUCA_creaturescript.lua"/>
	<event type="logout" name="Duca-Logout" event="script" value="DUCA_creaturescript.lua"/>
	<event type="preparedeath" name="Duca-Death" event="script" value="DUCA_creaturescript.lua"/>
	<event type="combat" name="Duca-Combat" event="script" value="DUCA_creaturescript.lua"/>
]]--
	
dofile('data/lib/DUCA.lua')

function onLogin(cid)
	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		DUCA.removePlayer(cid)
	end
	return true
end

function onLogout(cid)
	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not logout now!")
		return false
	end
	return true
end

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)

	local pontos = {[1] = 1, [2] = 1, [3] = 10, [4] = 30,}

	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		local pontos_ganhos = pontos[getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)]
		setPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS, getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) + pontos_ganhos)
		doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) .." duca points.")
		DUCA.removePlayer(cid)
		DUCA.updateRank()
	end
	return true
end

function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
			if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == getPlayerStorageValue(target, DUCA.STORAGE_TEAM) then
				return false
			end
		end
	end
	return true
end

 

 

  • Respostas 14
  • Visualizações 674
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Se eles forem do mesmo time, não poderá atacar. Como está demonstrado na parte do script:   function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then if getPlayerStorageVal

  • luanluciano93
    luanluciano93

    Só pode ser conflito entre storages. Defina novos valores de storages para o evento e teste ...   E caso tenha problemas com este evento crie um "issue" no meu git: https://github.com/luanlu

  • É como o @Dwarfer  disse, o script ta para não atacar somente quem for do mesmo time...   Troca isto:       Por isto, e seja feliz:       -- EDIT

Postado
  • Autor
19 minutos atrás, antharaz disse:

@JcA 

 

Mil perdões, entendi errado, entendi que você queria que o player não atacasse pessoas de qualquer time haha, a modificação correta seria trocar o return false do onPrepareDeath para return true. O correto ficará assim:

 

  Mostrar conteúdo oculto


--[[
	<!-- DUCA Event -->
	<event type="login" name="Duca-Login" event="script" value="DUCA_creaturescript.lua"/>
	<event type="logout" name="Duca-Logout" event="script" value="DUCA_creaturescript.lua"/>
	<event type="preparedeath" name="Duca-Death" event="script" value="DUCA_creaturescript.lua"/>
	<event type="combat" name="Duca-Combat" event="script" value="DUCA_creaturescript.lua"/>
]]--
	
dofile('data/lib/DUCA.lua')

function onLogin(cid)
	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		DUCA.removePlayer(cid)
	end
	return true
end

function onLogout(cid)
	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not logout now!")
		return false
	end
	return true
end

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)

	local pontos = {[1] = 1, [2] = 1, [3] = 10, [4] = 30,}

	if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
		local pontos_ganhos = pontos[getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)]
		setPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS, getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) + pontos_ganhos)
		doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) .." duca points.")
		DUCA.removePlayer(cid)
		DUCA.updateRank()
	end
	return true
end

function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) > 0 then
			if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == getPlayerStorageValue(target, DUCA.STORAGE_TEAM) then
				return false
			end
		end
	end
	return true
end

 

 

Não ataca ainda, só para tomar ciencia, o script não bloqueia para atacar entre mc né? Pelo menos não identifiquei nd, enfim, complicado

Postado

Só pode ser conflito entre storages. Defina novos valores de storages para o evento e teste ...

 

E caso tenha problemas com este evento crie um "issue" no meu git: https://github.com/luanluciano93/ESTUDOS/tree/master/LUA/DUCA

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

Postado

@JcA 

 

Acho que já nãoe ntendi mais nada do q vc qria asdhuiasdhuihuiasd, uma hora entendi que queria uma coisa, depois que você queria que morresse normal, agr qr q ataque >.<

 

acho melhor o autor do sistema te ajudar msm porque não to sabendo o que você ta querendo. :X

Postado
  • Autor
  • Solução
25 minutos atrás, antharaz disse:

@JcA 

 

Acho que já nãoe ntendi mais nada do q vc qria asdhuiasdhuihuiasd, uma hora entendi que queria uma coisa, depois que você queria que morresse normal, agr qr q ataque >.<

 

acho melhor o autor do sistema te ajudar msm porque não to sabendo o que você ta querendo. :X

 

 

 

O problema é o seguinte. o evento em si funciona, o problema é que não da para matar ng dps q entra no evento, nada mais alem disso.

Graças ao Anthraz, funcionou com isso aqui:

 

--[[
	<!-- DUCA Event -->
	<event type="login" name="Duca-Login" event="script" value="DUCA_creaturescript.lua"/>
	<event type="logout" name="Duca-Logout" event="script" value="DUCA_creaturescript.lua"/>
	<event type="preparedeath" name="Duca-Death" event="script" value="DUCA_creaturescript.lua"/>
	<event type="combat" name="Duca-Combat" event="script" value="DUCA_creaturescript.lua"/>
]]--
	
dofile('data/lib/DUCA.lua')

function onLogin(cid)
	if tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) > 0 then
		DUCA.removePlayer(cid)
	end
	return true
end

function onLogout(cid)
	if tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not logout now!")
		return false
	end
	return true
end

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)

	local pontos = {[1] = 1, [2] = 1, [3] = 10, [4] = 30,}

	if tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) > 0 then
		local pontos_ganhos = pontos[getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)]
		setPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS, getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) + pontos_ganhos)
		doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerStorageValue(deathList[1], DUCA.TOTAL_PONTOS) .." duca points.")
		DUCA.removePlayer(cid)
		DUCA.updateRank()
	end
	return false
end

function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) > 0 then
			if tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) == tonumber(getPlayerStorageValue(cid, DUCA.STORAGE_TEAM)) then
				return true
			end
		end
	end
	return true
end

 

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

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