Scripting/Squirrel/Functions/FindPickup: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Example added.)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 14: Line 14:
function onPlayerCommand( player, cmd, text )
function onPlayerCommand( player, cmd, text )
{
{
if(cmd == "/findpickup")
if(cmd == "findpickup")
{
{
local pickup = FindPickup(text.tointeger());
local pickup = FindPickup(text.tointeger());
Line 29: Line 29:
=== Notes ===
=== Notes ===
Call [[onPlayerCommand]] was used in this example. More info about it in the page.
Call [[onPlayerCommand]] was used in this example. More info about it in the page.
== Related Functions ==
{{Scripting/Squirrel/Functions/Pickup_Functions}}
[[Category:Scripting/Squirrel/Functions/Pickup_Functions]]

Latest revision as of 18:36, 30 January 2017

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.

Related Functions