Squirrel/Server/Functions/Blips/FindBlip
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 1. Non-player specific) |
(→Example 2. Player specific) |
||
Line 31: | Line 31: | ||
== Example 2. Player specific == | == Example 2. Player specific == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( pPlayer, szCommand, szText ) | |
+ | { | ||
+ | else if ( szCommand == "find2" ) | ||
+ | { | ||
+ | local pBlip; | ||
+ | if ( szText ) pBlip = FindBlip( szText.tointeger(), pPlayer ); | ||
+ | if ( pBlip ) MessagePlayer( "Found Blip ID " + szText, pPlayer ); | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in in this example. More info about them in the corresponding pages. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Blips}} | {{Squirrel/Server/Functions/Blips}} |
Revision as of 19:16, 28 September 2010
This function finds a blip from an ID and returns a pointer to it. If there is no such blip, null will be returned.
Syntax
Blip FindBlip( int id [, Player plr ] )
Arguments
- id - The ID of the blip to be found
- plr - If the blip you want to find is owned by a specific client, use this to specify the owner. If you don't use this argument the blip will be returned from the global blip pool
Example 1. Non-player specific
function onPlayerCommand( pPlayer, szCommand, szText ) { else if ( szCommand == "find" ) { local pBlip; if ( szText ) pBlip = FindBlip( szText.tointeger() ); if ( pBlip ) MessagePlayer( "Found Blip ID " + szText, pPlayer ); } }
Notes
The function MessagePlayer and event onPlayerCommand were used in in this example. More info about them in the corresponding pages.
Example 2. Player specific
function onPlayerCommand( pPlayer, szCommand, szText ) { else if ( szCommand == "find2" ) { local pBlip; if ( szText ) pBlip = FindBlip( szText.tointeger(), pPlayer ); if ( pBlip ) MessagePlayer( "Found Blip ID " + szText, pPlayer ); } }
Notes
The function MessagePlayer and event onPlayerCommand were used in in this example. More info about them in the corresponding pages.