From GT-MP
Jump to: navigation, search
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Sets an entity's transparency (alpha).


API.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.
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)


Sets a player's alpha to 50.

API.setEntityTransparency(player.handle, 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;
    API.setEntityTransparency(player.handle, alpha);
    API.sendNotificationToPlayer(player, "Alpha set to ~b~" + alpha);