Squirrel/Server/Functions/Vehicles/Respawn

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function respawns the given vehicle. == Syntax == <code>bool Vehicle.Respawn()</code> == Arguments == * '''none''' == Example == {{Squirrel/NeedsExample}} <code lang="s...)
 
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "respawnveh" )
 +
{
 +
if ( text )
 +
{
 +
local veh = FindVehicle( text.tointeger() );
 +
if ( veh )
 +
{
 +
veh.Respawn();
 +
MessagePlayer( "Respawned vehicle ID: " + text, player );
 +
}
 +
}
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This command will respawn the given vehicle ID.
  
 
=== 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 14:53, 8 March 2010

This function respawns the given vehicle.

Syntax

  1. bool Vehicle.Respawn()

Arguments

  • none

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "respawnveh" )
  5. {
  6. if ( text )
  7. {
  8. local veh = FindVehicle( text.tointeger() );
  9. if ( veh )
  10. {
  11. veh.Respawn();
  12. MessagePlayer( "Respawned vehicle ID: " + text, player );
  13. }
  14. }
  15. }
  16. }
  17.  

This command will respawn the given vehicle ID.

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