Squirrel/Server/Functions/Objects/Remove

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Object.Remove}} __NOTOC__ This ''Object'' class member removes the given object. == Syntax == <code>bool object.Remove()</code> == Example == {{Squirrel/Needs…')
 
(Example)
 
Line 8: Line 8:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
+
This will remove object ID 0 when the player types '/remove'
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- Todo
+
function onPlayerCommand( pPlayer, szCommand, szText )
 +
{
 +
if ( szCommand == "remove" )
 +
{
 +
local pObject = FindObject( 0 );
 +
 +
if ( pObject ) pObject.Remove();
 +
}
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.  
+
The function [[Squirrel/Server/Functions/Objects/FindObject|FindObject]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
 
+
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Objects}}
 
{{Squirrel/Server/Functions/Objects}}

Latest revision as of 00:19, 20 October 2010

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


This Object class member removes the given object.

[edit] Syntax

  1. bool object.Remove()

[edit] Example

This will remove object ID 0 when the player types '/remove'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "remove" )
  5. {
  6. local pObject = FindObject( 0 );
  7. if ( pObject ) pObject.Remove();
  8. }
  9. return 1;
  10. }
  11.  

[edit] Notes

The function FindObject and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox