ES/SetElementAlpha: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Server client function}} __NOTOC__ Esta funcion cambia el alpha (transparencia) de un determinado element. Puede ser: player, ped, object o vehicle. ==S...")
 
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Argumentos Requeridos===
*'''theElement:''' El [[element]] que quieres cambiar el alpha.
*'''theElement:''' El [[element]] que quieres cambiar el alpha.
*'''alpha:'''  El valor de alpha. Trasncurre entre 0-255, donde 255 es totalmente opaco y 0 totalmente transparente.
*'''alpha:'''  El valor de alpha. Trasncurre entre 0-255, donde 255 es totalmente opaco y 0 totalmente transparente.
** '''Nota:''' Los objetos son totalmente transparentes a 140.  
** '''Nota:''' Los objetos son totalmente transparentes a 140.
 
===Returns===
===Returns===
Returns ''true'' or ''false'' si hubiera argumentos inválidos.
Returns ''true'' or ''false'' si hubiera argumentos inválidos.


==Example==
==Ejemplos==
<section name="Clientside example" class="client" show="true">
<section name="Ejemplo clientside" class="client" show="true">
Este ejemplo hace al jugador invisible
Este ejemplo hace al jugador invisible
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 26: Line 27:
</section>
</section>


<section name="Serverside example" class="server" show="true">
<section name="Ejemplo serverside" class="server" show="true">
Este ejemplo te hace invisible al escribir /invis.
Este ejemplo te hace invisible al escribir /invis.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Latest revision as of 19:28, 24 June 2014

Esta funcion cambia el alpha (transparencia) de un determinado element. Puede ser: player, ped, object o vehicle.

Syntax

bool setElementAlpha ( element theElement, int alpha )

Argumentos Requeridos

  • theElement: El element que quieres cambiar el alpha.
  • alpha: El valor de alpha. Trasncurre entre 0-255, donde 255 es totalmente opaco y 0 totalmente transparente.
    • Nota: Los objetos son totalmente transparentes a 140.

Returns

Returns true or false si hubiera argumentos inválidos.

Ejemplos

Click to collapse [-]
Ejemplo clientside

Este ejemplo hace al jugador invisible

function invisible()
        setElementAlpha(localPlayer, 0)
end
addCommandHandler ( "invisible", invisible )
Click to collapse [-]
Ejemplo serverside

Este ejemplo te hace invisible al escribir /invis.

function toggleInvis ( thePlayer )  -- thePlayer is whoever executed the command
        if getElementAlpha( thePlayer ) == 0 then		-- if the player is NOT invisible
		setElementAlpha ( thePlayer, 0 )	-- cambia el alpha a 0 y lo hace invisible
	else			-- else, if the source player IS visible
		setElementAlpha ( thePlayer, 255 )	-- cambia el alpha a 255 y lo hace visible
	end
end
addCommandHandler ( "invis", toggleInvis )	-- Cuando escribes  /invis , la function 'toggleInvis' empieze.

See Also

Shared