Jump to content
Sign in to follow this  
hogmason

getting names next to player markers

Recommended Posts

i am wondering if any 1 can help,

I have found this script floating around google

Marker.sqf

_temp = _this select 0;
_varname = vehicleVarName _temp;
_unit = objnull;


createMarkerLocal [_varname, [0,0]];
_varname setMarkerShape "ICON";
_varname setMarkerColor "ColorBlack";
_varname setMarkerSize [1,1];
_varname setMarkerType "mil_dot";

while {true} do {
   waitUntil {
       call compile format ["_unit = %1",_varname];
       alive _unit;
   };

   while {alive _unit} do {
       if (side _unit == west) then {
           _varname setMarkerColor "ColorGreen";
       };
       if (side _unit == east) then {
           _varname setMarkerColor "ColorRed";
       };
       _varname setMarkerDir getDir _unit;
       _varname setMarkerPos getPos _unit;

       sleep 0.5;
   };
   _varname setMarkerColor "ColorBlack";
   sleep 5;
}; 

it is called by placing the following in the players unit init.

nul=[this] execVM "HOG scripts\marker.sqf";

It works fine to show a player marker on the map BUT i am wondering how would i also get the players name to show next to the marker. like in domination and

Share this post


Link to post
Share on other sites

// marker.sqf
// Creates a marker for a unit and displays their name and moves with them.
// Call: null = [this] execVM "marker.sqf";

_temp = _this select 0;
_varname = vehicleVarName _temp;
_unit = objnull;


_marker = createMarkerLocal [_varname, [0,0]];
_marker setMarkerShape "ICON";
_marker setMarkerColor "ColorBlack";
_marker setMarkerText _varname;
_marker setMarkerSize [1,1];
_marker setMarkerType "mil_dot";

while {true} do {
   waitUntil {
       call compile format ["_unit = %1",_varname];
       alive _unit;
   };

   while {alive _unit} do {
       if (side _unit == west) then {
           _varname setMarkerColor "ColorGreen";
       };
       if (side _unit == east) then {
           _varname setMarkerColor "ColorRed";
       };
       _varname setMarkerDir getDir _unit;
       _varname setMarkerPos getPos _unit;

       sleep 0.5;
   };
   _varname setMarkerColor "ColorBlack";
   sleep 5;
};

Try that, its should now display the name of the unit it is attached to!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×