Squirrel/Server/Functions/Players/WantedLevel

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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 ==
  
{{Squirrel/NeedsExample}}
+
This will tell the player their current wanted level when type '/wanted'.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
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 ==
  
{{Squirrel/NeedsExample}}
+
This will give the player a 1 star wanted level when they type '/wanted2'.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( pPlayer, szCommand, szText )
 +
{
 +
if ( szCommand == "wanted2" )
 +
{
 +
pPlayer.WantedLevel = 1;
 +
}
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function sets/returns the players wanted level.

[edit] Syntax

  1. int player.WantedLevel
  1. 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'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "wanted" )
  5. {
  6. MessagePlayer( "Your current wanted level is - " + pPlayer.WantedLevel, pPlayer );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Example 2. Setting

This will give the player a 1 star wanted level when they type '/wanted2'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "wanted2" )
  5. {
  6. pPlayer.WantedLevel = 1;
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

The function MessagePlayer and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox