Squirrel/Server/Functions/Vehicles/SetRadio

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function sets a radio channel for the given vehicle. Note that this will only work if someone is in the vehicle. == Syntax == <code>bool Vehicle.SetRadio( int channel )</co...)
 
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "setradio" )
 +
{
 +
if ( player.Vehicle ) player.Vehicle.SetRadio( 2 );
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This command will turn set the radio station of the vehicle the player is driving to radio channel 2.
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
The call [[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/Vehicles}}
 
{{Squirrel/Server/Functions/Vehicles}}

Revision as of 15:06, 8 March 2010

This function sets a radio channel for the given vehicle. Note that this will only work if someone is in the vehicle.

Syntax

  1. bool Vehicle.SetRadio( int channel )

Arguments

  • channel - The radio channel to be set

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setradio" )
  5. {
  6. if ( player.Vehicle ) player.Vehicle.SetRadio( 2 );
  7. }
  8. }
  9.  

This command will turn set the radio station of the vehicle the player is driving to radio channel 2.

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox