Scripting/Squirrel/Functions/FindPickup: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
ProsuWANTED (talk | contribs) (Created the page with arguments but without an example.) |
ProsuWANTED (talk | contribs) (Example added.) |
||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
<source lang=squirrel> | |||
function onPlayerCommand( player, cmd, text ) | |||
{ | |||
if(cmd == "/findpickup") | |||
{ | |||
local pickup = FindPickup(text.tointeger()); | |||
if (pickup) | |||
{ | |||
pickup.Pos = player.Pos; | |||
MessagePlayer("[#00FF00]Pickup has been found and has been teleported to you!", player); | |||
} else { | |||
MessagePlayer("[#FF0000]Pickup has not been found :(", player); | |||
} | |||
} | |||
} | |||
</source> | |||
=== Notes === | === Notes === | ||
Call [[onPlayerCommand]] was used in this example. More info about it in the page. |
Revision as of 17:43, 1 July 2015
Finds a pickup with that ID and returns its instance.
Syntax
FindPickup(ID)
Arguments
- int ID - The ID of the pickup to find
Example
function onPlayerCommand( player, cmd, text )
{
if(cmd == "/findpickup")
{
local pickup = FindPickup(text.tointeger());
if (pickup)
{
pickup.Pos = player.Pos;
MessagePlayer("[#00FF00]Pickup has been found and has been teleported to you!", player);
} else {
MessagePlayer("[#FF0000]Pickup has not been found :(", player);
}
}
}
Notes
Call onPlayerCommand was used in this example. More info about it in the page.