Squirrel/Server/Functions/Vehicles/Marker

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Typo fix (and -> an))
(Example)
 
(2 intermediate revisions by one user not shown)
Line 13: Line 13:
 
* '''value''' - The type of the blip. For reference, check [[Squirrel/Server/Constants#Radar_Blip_Types|here]].
 
* '''value''' - The type of the blip. For reference, check [[Squirrel/Server/Constants#Radar_Blip_Types|here]].
  
== Example 1. Returning ==
+
== Example ==
  
 
This will tell the player the type of the marker on their vehicle when they type '/marker'.
 
This will tell the player the type of the marker on their vehicle when they type '/marker'.
Line 20: Line 20:
 
function onPlayerCommand( plr, cmd, text )
 
function onPlayerCommand( plr, cmd, text )
 
{
 
{
if ( cmd == "marker" )
+
if ( cmd == "Arrow" )
 
{
 
{
 
local veh = plr.Vehicle;
 
local veh = plr.Vehicle;
 
if ( veh )
 
if ( veh )
MessagePlayer( "This vehicle has marker type - " + veh.Marker, plr );
+
veh.Marker = BLIPTYPE_ARROWONLY;
 
else
 
else
MessagePlayer( "You are not in a vehicle", plr );
+
MessagePlayer( "[#00ff00]*System* [#ff0000]You are not in a vehicle", plr );
 
}
 
}
 
 
 
return 1;
 
return 1;
 
}
 
}
</code>
 
  
== Example 2. Setting ==
+
function onPlayerExitingVehicle( player, vehicle )
 +
{
 +
  vehicle.Marker = false;
  
This will set the vehicles marker to an arrow when they type '/arrowmarker'.
+
    return 0;
 
+
<code lang="squirrel">
+
function onPlayerCommand( plr, cmd, text )
+
{
+
if ( cmd == "arrowmarker" )
+
{
+
local veh = plr.Vehicle;
+
if ( veh )
+
veh.Marker = BLIPTYPE_ARROWONLY;
+
else
+
MessagePlayer( "You are not in a vehicle", plr );
+
}
+
+
return 1;
+
 
}
 
}
 
</code>
 
</code>

Latest revision as of 14:21, 10 August 2013

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

This function sets/returns the vehicles radar marker type.

[edit] Syntax

  1. int vehicle.Marker
  1. vehicle.Marker = int value

[edit] Arguments

  • value - The type of the blip. For reference, check here.

[edit] Example

This will tell the player the type of the marker on their vehicle when they type '/marker'.

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "Arrow" )
  5. {
  6. local veh = plr.Vehicle;
  7. if ( veh )
  8. veh.Marker = BLIPTYPE_ARROWONLY;
  9. else
  10. MessagePlayer( "[#00ff00]*System* [#ff0000]You are not in a vehicle", plr );
  11. }
  12. return 1;
  13. }
  14.  
  15. function onPlayerExitingVehicle( player, vehicle )
  16. {
  17. vehicle.Marker = false;
  18.  
  19. return 0;
  20. }
  21.  

[edit] Notes

The function MessagePlayer and event onPlayerCommand were used in these examples. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox