Squirrel/Server/Functions/Pickups/OneTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Pickup.OneTime}} __NOTOC__ This ''Pickup'' class member returns/sets whether the given pickup removes when you hit it. == Syntax == You can either return or set…')
 
 
Line 12: Line 12:
 
* '''bOneTime''' - A boolean representing whether the given pickup removes when you hit it.
 
* '''bOneTime''' - A boolean representing whether the given pickup removes when you hit it.
  
== Example ==
+
== Example 1. Returning ==
  
{{Squirrel/NeedsExample}}
+
This will tell the player the current OneTime status of the pickup they collected.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- Todo
+
function onPickupPickedUp( pPlayer, pPickup )
 +
{
 +
MessagePlayer( "Pickup One Time: " + pPickup.OneTime, pPlayer );
 +
 +
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/Pickup/onPickupPickedUp|onPickupPickedUp]] were used in this example. More info about them in the corresponding pages.
  
 +
== Example 2. Setting ==
 +
 +
This will set the pickup they collected to be OneTime
 +
 +
<code lang="squirrel">
 +
function onPickupPickedUp( pPlayer, pPickup )
 +
{
 +
pPickup.OneTime = true;
 +
 +
return 1;
 +
}
 +
</code>
 +
 +
=== Notes ===
 +
 +
The event [[Squirrel/Server/Events/Pickup/onPickupPickedUp|onPickupPickedUp]] was used in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Pickups}}
 
{{Squirrel/Server/Functions/Pickups}}

Latest revision as of 17:55, 23 October 2010

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


This Pickup class member returns/sets whether the given pickup removes when you hit it.

[edit] Syntax

You can either return or set a new value using this member:

  1. Bool pickup.OneTime
  1. pickup.OneTime = bool bOneTime

[edit] Arguments

  • bOneTime - A boolean representing whether the given pickup removes when you hit it.

[edit] Example 1. Returning

This will tell the player the current OneTime status of the pickup they collected.

  1.  
  2. function onPickupPickedUp( pPlayer, pPickup )
  3. {
  4. MessagePlayer( "Pickup One Time: " + pPickup.OneTime, pPlayer );
  5. return 1;
  6. }
  7.  

[edit] Notes

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

[edit] Example 2. Setting

This will set the pickup they collected to be OneTime

  1.  
  2. function onPickupPickedUp( pPlayer, pPickup )
  3. {
  4. pPickup.OneTime = true;
  5. return 1;
  6. }
  7.  

[edit] Notes

The event onPickupPickedUp was used in this example. More info about this in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox