Squirrel/Server/Functions/Players/Alpha
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 1. Returning) |
(Cleaned up the page) |
||
Line 13: | Line 13: | ||
== Example 1. Returning == | == Example 1. Returning == | ||
− | + | This example will let the player know their current alpha setting when they type '/getalpha'. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
function onPlayerCommand( pPlayer, szCommand, szText ) | function onPlayerCommand( pPlayer, szCommand, szText ) | ||
{ | { | ||
− | + | if ( szCommand == "getalpha" ) | |
− | + | { | |
− | + | MessagePlayer( "Your alpha state is currently set to " + pPlayer.Alpha, pPlayer ); | |
− | + | } | |
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 28: | Line 29: | ||
=== Notes === | === Notes === | ||
− | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them can be found in the corresponding pages. | |
− | + | ||
== Example 2. Setting == | == Example 2. Setting == | ||
− | + | This example will set the player almost completely transparent when they type '/ghost'. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
function onPlayerCommand( pPlayer, szCommand, szText ) | function onPlayerCommand( pPlayer, szCommand, szText ) | ||
{ | { | ||
− | + | if ( szCommand == "ghost" ) | |
− | + | { | |
− | + | pPlayer.Alpha = 10; | |
− | + | } | |
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 48: | Line 49: | ||
=== Notes === | === Notes === | ||
− | + | The event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page. | |
− | + | ||
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Players}} | {{Squirrel/Server/Functions/Players}} |
Latest revision as of 00:43, 17 November 2010
This Player class variable sets/returns the alpha of the player ped. Note that this settings does not affect weapons or special skins.
[edit] Syntax
int player.Alpha
player.Alpha = int alpha
[edit] Arguments
- alpha - The alpha value you wish to set (0...255)
[edit] Example 1. Returning
This example will let the player know their current alpha setting when they type '/getalpha'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "getalpha" ) { MessagePlayer( "Your alpha state is currently set to " + pPlayer.Alpha, pPlayer ); } return 1; }
[edit] Notes
The function MessagePlayer and event onPlayerCommand were used in this example. More info about them can be found in the corresponding pages.
[edit] Example 2. Setting
This example will set the player almost completely transparent when they type '/ghost'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "ghost" ) { pPlayer.Alpha = 10; } return 1; }
[edit] Notes
The event onPlayerCommand was used in in this example. More info about this in the corresponding page.
[edit] Related Functions
- FindPlayer
- GetClosestPlayer
- Player.Alpha
- Player.Angle
- Player.Armour
- Player.Cash
- Player.Class
- Player.ClearWeapons
- Player.Colour
- Player.ColouredName
- Player.EnterVehicle
- Player.ExitVehicle
- Player.ForceToSpawnScreen
- Player.Frozen
- Player.GetBoundariesLower
- Player.GetBoundariesUpper
- Player.GetIgnored
- Player.Health
- Player.ID
- Player.IP
- Player.Immune
- Player.Island
- Player.LUID
- Player.Marker
- Player.MarkerScale
- Player.MarkerSprite
- Player.Muted
- Player.Name
- Player.Nametag
- Player.NametagColour
- Player.Ping
- Player.Pos
- Player.RemoveFromVehicle
- Player.RemoveLimb
- Player.Score
- Player.SetAnim
- Player.SetBoundaries
- Player.SetIgnored
- Player.SetIgnoredBy
- Player.SetVehicleEnterDoor
- Player.SetWeapon
- Player.Skin
- Player.Spawn
- Player.Spawned
- Player.Team
- Player.Train
- Player.Vehicle
- Player.VehicleSeat
- Player.Velocity
- Player.VirtualWorld
- Player.WantedLevel
- Player.Weapon
- Player.SetWeapon
- Player.WeaponAmmo
- Player.WeaponState