Squirrel/Client/Events/Pickup/onPickupRespawn

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|onPickupRespawn}} This event is called a pickup has been respawned. == Syntax == <code>function onPickupRespawn( pickup )</code> === Arguments === * '''picku…')
 
(Added example)
Line 16: Line 16:
 
== Example ==
 
== Example ==
  
Some explanation here
+
This function teleports a player near a pickup after it respawns.
{{Squirrel/NeedsExample}}
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPickupRespawn( pickup )
 +
{
 +
    local player = FindLocalPlayer();
 +
    player.Pos = Vector( (pickup.Pos.x - 3), (pickup.Pos.y - 3), pickup.Pos.z );
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The client functions [[Squirrel/Client/Functions/Pickups/Pos|Pickup.Pos]], [[Squirrel/Client/Functions/Players/Pos|Player.Pos]] and [[Squirrel/Client/Functions/Players/FindLocalPlayer|FindLocalPlayer]] were used in this example. More information can be found on their corresponding pages.
  
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/Pickups}}
 
{{Squirrel/Client/Events/Pickups}}

Revision as of 12:39, 2 August 2011

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

This event is called a pickup has been respawned.

Syntax

  1. function onPickupRespawn( pickup )

Arguments

  • pickup - The pointer of the pickup thats been respawned

Returns

This event does not handle return values.

Example

This function teleports a player near a pickup after it respawns.

  1.  
  2. function onPickupRespawn( pickup )
  3. {
  4. local player = FindLocalPlayer();
  5. player.Pos = Vector( (pickup.Pos.x - 3), (pickup.Pos.y - 3), pickup.Pos.z );
  6. }
  7.  

Notes

The client functions Pickup.Pos, Player.Pos and FindLocalPlayer were used in this example. More information can be found on their corresponding pages.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox