Squirrel/Server/Functions/Blips/Owner

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
 
Line 11: Line 11:
  
 
== Example ==
 
== Example ==
 +
 +
This example function will return the name of the blip owner (or "Unknown" if the blip is a global blip) when called.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerCommand( pPlayer, szCommand, szText )
+
// This is a custom function
 +
function GetBlipOwnerName( blip )
 
{
 
{
if ( szCommand == "owner" )
+
    if ( blip.Owner ) return blip.Owner.Name;
{
+
    return "Unknown";
local pBlip = FindBlip( 0 );
+
if ( pBlip ) MessagePlayer( "Blip ID 0 has no owner", pPlayer );
+
else
+
{
+
pBlip = FindBlip( 0, pPlayer );
+
if ( pBlip ) MessagePlayer( "Blip ID 0's owner is - " + pBlip.Owner, pPlayer );
+
}
+
}
+
 
}
 
}
 
</code>
 
</code>
Line 30: Line 25:
 
=== 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.
+
The function [[Squirrel/Server/Functions/Players/Name|Player.Name]] was used in in this example. More info about it in the corresponding page.
 +
 
 +
Note that this function is a completely custom function, you'll have to call it using your own script.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Blips}}
 
{{Squirrel/Server/Functions/Blips}}

Latest revision as of 00:22, 29 September 2010

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

This Blip class member returns a pointer to the owner of this blip, or null if the blip is visible for everyone.

[edit] Syntax

  1. Player Blip.Owner

[edit] Arguments

  • none

[edit] Example

This example function will return the name of the blip owner (or "Unknown" if the blip is a global blip) when called.

  1.  
  2. // This is a custom function
  3. function GetBlipOwnerName( blip )
  4. {
  5. if ( blip.Owner ) return blip.Owner.Name;
  6. return "Unknown";
  7. }
  8.  

[edit] Notes

The function Player.Name was used in in this example. More info about it in the corresponding page.

Note that this function is a completely custom function, you'll have to call it using your own script.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox