ES/SetElementAlpha

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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