SetEntityTransparency

From GTA Network Wiki
Jump to: navigation, search

SetEntityTransparency
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

Sets an entity's transparency (alpha).

Syntax

void NAPI.Entity.SetEntityTransparency(NetHandle entity, int newAlpha);

Required Arguments

  • entity: The entity handle to set the alpha. This parameter input should be in NetHandle type.
  • newAlpha: The new alpha value, between 0 and 255, as 0 means invisible and 255 is normally visible. This parameter input should be in int type.


icon-info.png
Attention: Changing an entity's transparency will not affect anything "attached" to it, such as an entity's shadow or a player's current weapon.


Usage example(s)

alpha-example-50.png

Sets a player's alpha to 50.

NAPI.Entity.SetEntityTransparency(player, 50);

A command to set the player alpha to a specified number.

[Command("alpha", Description = "Sets your transparency")]
public void Command_Alpha(Client player, int alpha)
{
    if (alpha < 0) alpha = 0;
    if (alpha > 255) alpha = 255;
    NAPI.Entity.SetEntityTransparency(player, alpha);
    NAPI.Notification.SendNotificationToPlayer(player, "Alpha set to ~b~" + alpha);
}

Changelog

Version Description
1.0 Release.

References