Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Deleting markers originally defined by player uid

  1. #1

    Deleting markers originally defined by player uid

    long story short - i created markers for players that join the server which will follow them around the map - i used uid to assign the marker which is created and setmarker text - to the players name
    On joining the marker is there and shows in MP.

    Problem...
    On disconnection i use the same uid to deletemarker - nothing not a thing. even tried mpframe work - couldnt get it to work.

    so does anybody know the way to delete such markers

    code as follows

    activated via [] execVM "marker.sqf"; - tried onplayerconnected [_id,_name] etc - _name comes back as "ANY" - think its the name given to the server. Anyway...

    marker.sqf
    Code:
    _caller = name player;
    _uid = getPlayerUID player;
    [nil,nil,rHINT, format["%1 connected",_uid]] call RE;
    if (isserver) then
    {     //also tried createmarkerlocal :(
    	_marker = createMarker [_uid, position player]; 
    	_uid setMarkerText _uid;  //can change this to _caller - shows players name
    	_uid setMarkerType "NATO_base";
    	_uid setMarkerColor "ColorRed";
    			
    	while {!isnull player} do
    	{
    	_uid setmarkerpos getpos player;
    	sleep 5;				
    	};				
    } else
    
    {
    	_marker = createMarker [_uid, position player]; 
    	_uid setMarkerText _uid;    //can change this to _caller - shows players name
    	_uid setMarkerType "NATO_base";
    	_uid setMarkerColor "ColorRed";
    
    	while {!isnull player} do
    	{
    	_uid setmarkerpos getpos player;
    	sleep 5;		
    	};
    };


    following code is called when player disconnects -
    defined in the init as ..
    onPlayerDisconnected "[_id, _name, _uid] execVM 'removenamedmarkers.sqf';"; - this hints the exact uid (as shown in the their defined marker within game) when someone leaves.

    removenamedmarkers.sqf
    Code:
    deletemarkers1 = {
    	deletemarker  format ["%1",_named];
    	deletemarker  format ["%1",_idname];
    	 deletemarker _uid;	
    	 deletemarkerlocal _named;	
    	 deletemarker _named;	
    	 deletemarkerlocal _idname;
    	 deletemarkerlocal  format ["%1",_named];
    	deletemarkerlocal  format ["%1",_idname];
    };
    
    _uid = _this select 2;
    _caller = _this select 1;
    _named = str(_uid);
    _idname = _uid;
    [nil,nil,rHINT, format["%1 disconnecting",_idname]] call RE;
    [nil,nil,"per",rSPAWN,[], {[] call deletemarkers1}];
    lobbed as much delete marker stuff in there to see if any work - nope!

    So no idea how to get this working - any help would be much appreciated - spent way too long on this
    [FOCK] Mikie J -
    Giving bad advice since 2007

    Looking for New Players/scripters at Fockersteam
    http://fockers.moonfruit.com/
    Email:

    A3
    3 Chpaters of Scripting Tutotials -http://www.armaholic.com/page.php?id=20465#comments MORE TO FOLLOW
    TvTCache Hunt - [FOCK]ers Cache Hunt TvT-x [ALPHA]
    Fock Recruit/Group Management - http://www.armaholic.com/page.php?id=19041

  2. #2
    have you tried
    Code:
    	while {!isnull player} do
    	{
    	_uid setmarkerpos getpos player;
    	sleep 5;				
    	};
    deleteMarker _marker;
    edit: only the server needs to update markers. they're global unless you're using the xxxmarkerLocal command.
    i'd recommend doing everything client side tho.
    Last edited by cuel; Apr 5 2012 at 01:57.

  3. #3
    Master Sergeant sxp2high's Avatar
    Join Date
    Jul 16 2009
    Location
    nearestLocation [(getPos player), "nameCity"];
    Posts
    766
    PHP Code:
    onPlayerDisconnected "deleteMarker format['%1', _uid];"
    This doesn't work?

  4. #4
    Master Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    656
    Author of the Thread
    alas - neither method works.

    cuel - thats how i had it at the start. thought that would have done it, especially as i have identified in that script the name given to create the marker.

    sxp2high - alas that did not work either - which looks as it that would do the job for the reason shown below.

    appears on disconnecting everything to do with the player is wiped - the onPlayerDisconnected "[_id, _name, _uid]... part seems to find the uid - calls it in a hint as disconnecting - but not joy.

    very strange - any other takers?

  5. #5
    Master Sergeant sxp2high's Avatar
    Join Date
    Jul 16 2009
    Location
    nearestLocation [(getPos player), "nameCity"];
    Posts
    766
    This is for a dedicated server, right?

  6. #6
    Master Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    656
    Author of the Thread
    yeah dedicated server - doesnt work on hosted either;
    just absolutely lost in which direction to go.

    ive changed _marker to global var - marker -

    I added an addaction to each player - deletemarker marker; - that works! and the attached marker goes.

    i also used the same addaction with this code...

    _uid = getPlayerUID player; deletemarker _uid;

    that worked -
    so is this a locality issue?
    Last edited by Mikie boy; Apr 5 2012 at 18:15.

  7. #7
    Master Sergeant sxp2high's Avatar
    Join Date
    Jul 16 2009
    Location
    nearestLocation [(getPos player), "nameCity"];
    Posts
    766
    Yea, kinda. You cannot use the variable player on a dedicated server. The dedicated server will exit at that position with an error. Error: Undefined variable: player

    When you are testing stuff on a dedicated server, you have to look at your local -and- the server's RPT files. The server may have different errors than the clients.

    You can use this code. Just put it in your init.sqf
    PHP Code:
    waitUntil {!(isNull player) || isDedicated}; // Make init.sqf JIP compatible


    if (!isDedicatedthen {
        [] 
    spawn {
            
    _caller name player;
            
    _uid getPlayerUID player;

            
    _marker createMarker [_uid, (getPosATL (vehicle player))]; 
            
    _marker setMarkerText _uid;    //can change this to _caller - shows players name
            
    _marker setMarkerType "NATO_base";
            
    _marker setMarkerColor "ColorRed";

            while {
    true} do {
                
    _marker setMarkerPos (getPosATL (vehicle player));
                
    sleep 5;        
            };
        };
    };


    onPlayerDisconnected "deleteMarker format['%1', _uid];"

  8. #8
    Master Sergeant Mikie boy's Avatar
    Join Date
    Jun 20 2009
    Location
    United Kingdoom
    Posts
    656
    Author of the Thread
    Alas, no joy. had a go at different methods of removing the marker.

    hinted to obtain the markers name (_uid) - shows the same as thought.
    however on disconnecting the marker is still showing on the other persons screen (who is still connected). I think therefore this is a matter of having to delete that particular marker from all computers.
    I have tried MP frame work to delete it from all computers - no joy.
    this is annoying - thought this would have been the easy bit lol.

  9. #9
    I shall not insult moderators
    Join Date
    Nov 25 2010
    Posts
    1,576
    BIS_fnc_listPlayers
    Any good? You may be able to add/subtract arrays with this?
    scriptName "Functions\misc\fn_listPlayers.sqf";
    Code:
    /*
    	File: listPlayers.sqf
    	Author: Karel Moricky
    
    	Description:
    	Returns list of players and playable units
    
    	Returns:
    	Boolean (true when position is in area, false if not).
    */
    private ["_this","_SPlist","_MPlist","_resultList"];
    
    _SPlist = switchableUnits;
    _MPlist = playableunits;
    _resultList = [player];
    
    if (isnil "_this") then {
    	{
    		if !(_x in _resultList) then {_resultList = _resultList + [_x]};
    	} foreach (_SPlist + _MPlist);
    } else {
    	{
    		if (isplayer _x && !(_x in _resultList)) then {_resultList = _resultList + [_x]};
    	} foreach (_SPlist + _MPlist);
    };
    
    _resultList;

  10. #10
    When I want to track players I usually run a script clientside, using only xxxMarkerLocal commands. Just loop, create markers, add them to an array and delete them before the loop ends.
    Some old script I used to track players inside cars (only the driver)

    PHP Code:
    _markArr = [];
    while {
    true} do {
        
    waitUntil {sleep 0.2alive player};
        {
            if ((
    side _x) == EAST && vehicle _x != _xthen {
                if (
    driver (vehicle _x) == _xthen {
                    
    _id=format["trk_%1",_x];
                    
    _mark createMarkerLocal [_id, [(getPosATL _x select 0),(getPosATL _x select 1)]];
                    
    _mark setMarkerShapeLocal "ICON";
                    
    _mark setMarkerTypeLocal "mil_box";
                    
    _mark setMarkerColorLocal "ColorBlue";
                    
    _mark setMarkerTextLocal format [" %1"name _x];
                    
    sleep 0.02;
                    
    _markArr _markArr + [_mark];
                };
            };
        } forEach 
    playableUnits;
        
        
    sleep 8;
        {
                
    deleteMarkerLocal _x
        
    }forEach _markArr;
    }; 
    Then you won't have to send marker updates over the network.

Page 1 of 2 12 LastLast

Similar Threads

  1. Preset Weapon selections by player UID [script]
    By Demonized in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 89
    Last Post: May 5 2014, 12:38
  2. Player UID trigger
    By 7Cav1Clip in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 7
    Last Post: Apr 8 2014, 00:21
  3. Issue with user defined markers
    By Matthijs in forum TROUBLESHOOTING
    Replies: 1
    Last Post: Apr 3 2002, 15:58
  4. Need help with user defined markers
    By Royal_Blackwatch in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Feb 25 2002, 07:59
  5. Multiplayer user defined markers
    By LAW Soldier fd in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Nov 24 2001, 20:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •