Squirrel/Server/Functions/Players/WantedLevel
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|Player.WantedLevel}} This function sets/returns the players wanted level. == Syntax == <code>int player.WantedLevel</code> <code>player.WantedLevel = int value…') |
|||
Line 13: | Line 13: | ||
== Example 1. Returning == | == Example 1. Returning == | ||
− | + | This will tell the player their current wanted level when type '/wanted'. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( pPlayer, szCommand, szText ) | |
+ | { | ||
+ | if ( szCommand == "wanted" ) | ||
+ | { | ||
+ | MessagePlayer( "Your current wanted level is - " + pPlayer.WantedLevel, pPlayer ); | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
== Example 2. Setting == | == Example 2. Setting == | ||
− | + | This will give the player a 1 star wanted level when they type '/wanted2'. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( pPlayer, szCommand, szText ) | |
+ | { | ||
+ | if ( szCommand == "wanted2" ) | ||
+ | { | ||
+ | pPlayer.WantedLevel = 1; | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in these examples. More info about them in the corresponding pages. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Players}} | {{Squirrel/Server/Functions/Players}} |
Latest revision as of 16:31, 25 October 2010
This function sets/returns the players wanted level.
[edit] Syntax
int player.WantedLevel
player.WantedLevel = int value
[edit] Arguments
- value - The value to set the wanted level to. From 0 - 6.
[edit] Example 1. Returning
This will tell the player their current wanted level when type '/wanted'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "wanted" ) { MessagePlayer( "Your current wanted level is - " + pPlayer.WantedLevel, pPlayer ); } return 1; }
[edit] Example 2. Setting
This will give the player a 1 star wanted level when they type '/wanted2'.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "wanted2" ) { pPlayer.WantedLevel = 1; } return 1; }
[edit] Notes
The function MessagePlayer and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.
[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