Squirrel/Server/Functions/Vehicles/Marker

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example 2. Setting)
(Example 1. Returning)
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( "[#ff00ff]You are not in a vehicle", plr );
 
}
 
}
 
 
 
return 1;
 
return 1;
 +
}
 +
 +
function onPlayerExitingVehicle( player, vehicle )
 +
{
 +
  vehicle.Marker = false;
 +
 +
    return 0;
 
}
 
}
 
</code>
 
</code>

Revision as of 14:20, 10 August 2013

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

This function sets/returns the vehicles radar marker type.

Syntax

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

Arguments

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

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( "[#ff00ff]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.  

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox