Jump to content

Variáveis locais em client é global para geral ou apenas para a instância daquele jogador?


Recommended Posts

Quando um jogador morre, um evento é disparado ('death:contador') passando APENAS aquele jogador (não root), ou seja, o evento é chamado apenas pelo jogador que morreu.

Após o jogador ter engatilhado o evento de contador, uma variável local chamada "morto" é atribuída como verdadeira, para assim ele não tomar dano no evento "onClientPlayerDamage".

A minha dúvida é sobre as variáveis locais em 'Clientes', elas são visíveis para os outros 'Clientes' ? ou apenas para aquele jogador? por que se for visível para todos, todos não irão tomar dano pois terão o dano cancelado pelo "onClientPlayerDamage". 

addEventHandler( "onClientPlayerDamage", getRootElement(), 
function (attacker, damage_causing, bodypart, loss) 
--The source of this event is the player that got damaged. (Streamed in players only)
--If this event is canceled, then any damaging effects to the local player will cease.
	if morto then
		cancelEvent()
	end
end)

addEvent("death:contador", true)
addEventHandler("death:contador", getRootElement(), function(mim, seg)
	morto = true
	-- resto de código bla bla bla
end)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...