Knifedge 1 Posted June 14, 2018 Can someone please help me on the below: The script is working correctly bar one thing. When the marker is added to the map I want it to have in brackets (Marked by <playerName>) however currently it just adds "CAS Target (Marked by any)" Can someone explain why the name command is not returning the name of the player? I have in the Init box of the unit in the editor: nul = [this] execVM "scripts\add_markcastarget_action.sqf"; This is add_markcastarget_action.sqf _currentPlayer = _this select 0; _playerName = name _currentPlayer; sleep 10; fnc_addActionMP = { private["_object", "_screenMsg", "_scriptToCall"]; _object = _this select 0; _screenMsg = _this select 1; _scriptToCall = _this select 2; if(isNull _object) exitWith {}; _object addaction [_screenMsg,_scriptToCall]; }; [_currentPlayer, "<t color='#f20000'>" + "Mark CAS Target" + "</t>", { titleText ["Click to mark CAS Target location.", "PLAIN"]; openMap [true, false]; _attachedTo = (_this select 0); ["mk_cas", "onMapSingleClick", { titleText ["", "PLAIN"]; _markerName = "CASMARKER_" + (str _pos); _marker = createMarker [_markerName, _pos]; _marker setMarkerType "hd_destroy"; _marker setMarkerColor "ColorRed"; _marker setMarkerText format["CAS Target (Marked by %1)", _playerName]; ["mk_cas", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; true; }, [_attachedTo]] call BIS_fnc_addStackedEventHandler } ] remoteExec ["fnc_addActionMP"]; 1 Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted June 15, 2018 _playerName is not defined inside the onMapSingleClick command. Replace it with "name player". Cheers 2 Share this post Link to post Share on other sites
Knifedge 1 Posted June 15, 2018 Brilliant, thankyou :), reading up on https://community.bistudio.com/wiki/player makes sense as the command is executed on each client. Share this post Link to post Share on other sites