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

Thread: Player Slot Restrictions

  1. #1

    Player Slot Restrictions

    Hello,

    I was wondering if it would be possible to restrict Domi player slots to only allow certain playerID's? We would like to run a public server but only allow certain people to occupy the Pilot slots with the "Only Pilots may fly" enabled... Sort of like how you can restrict vehicles to only be crewed by people on a "Fly List".

    Thanks in advance.

  2. #2
    Sergeant
    Join Date
    Feb 17 2012
    Location
    Gaillimh, Galway, Ireland, Ireland
    Posts
    106
    i would be interested in this too. did you find a solution?

  3. #3

  4. #4
    Sergeant
    Join Date
    Feb 17 2012
    Location
    Gaillimh, Galway, Ireland, Ireland
    Posts
    106
    hmm that thread is about vehicles.
    i am looking to reserver slots in the lobby for players.

    i got as far as locking one slot to my ID by using


    Code:
    OnPlayerConnected "[_uid,_name] execVM ""checkslot.sqf""";
    in the init.sqf

    and
    created a checkslot.sqf with:
    Code:
    _uid = _this select 0;
    _name = _this select 1;
    
    _slot1 = ["123456","654321","321654"];
    
    if ((isplayer wslot1) and not (_uid in _slot1)) then
    
    {
    
    serverCommand Format["#kick %1",_name];
    
    };
    now the point is to lock several slots to individual clan members (some of them with multiple options)
    i know how to add several id's to one slot.
    but i am at a loss as to how to add further slots as it were.

    Code:
    //mcspeed
    _uid = _this select 0;
    
    _name = _this select 1;
    
    _slot41 = ["123456"];
    
    if ((isplayer wslot41) and not (_uid in _slot41)) then
    
    {
    
    serverCommand Format["#kick %1",_name];
    
    };
    
    //steinmetz- team lead
    _uid = _this select 0;
    
    _name = _this select 1;
    
    _slot25 = ["654321"];
    
    if ((isplayer wslot25) and not (_uid in _slot25)) then
    
    {
    
    serverCommand Format["#kick %1",_name];
    
    };
    does still lock the first slot but the second lock is not being applied.
    i am a total noob at scripting and so far survived by ripping scripts apart.
    So i think i might just be missing something in the script to seperate the different commands?

    EDIT. nvm ... doesnt work at all , not even for the first slot (slot41)

    this is wrecking myhead...
    Last edited by McSpeed; Mar 4 2012 at 15:31.

  5. #5
    I totally missed the original question, sry.

    try this (untested, i also removed the isplayer check since this is only invoked onPlayerConnected event)

    Code:
    _uid = _this select 0;
    _name = _this select 1;
    
    //list of UIDs - mcspeed, steinmetz- team lead
    _allowedUIDs = ["123456","654321"];
    {
    	if (_uid != _x) then {
    		serverCommand Format["#kick %1",_name];
    	};
    }forEach _allowedUIDs;
    };
    I have no way to test this, and have no experience mp wise, so be advised.

  6. #6
    Sergeant
    Join Date
    Feb 17 2012
    Location
    Gaillimh, Galway, Ireland, Ireland
    Posts
    106
    where do i define which slot is available though?

    let me elaborate on what i am trying to do :
    46 playable slots

    slots 25-32 and 41-44 should be restricted to individual id's

    where 25 and 41 should be restricted to the respective squad leaders in our clan.

    so like:
    slot 25 guid: 11111111
    slot 26-32 guid: 22222, 3333, 444, 5555 etc
    slot 44 guid: 99999
    and so forth...

    i am surprised this subject is so hard to find.

    i am so glad though you are taking the time to help me out here


    .... oh wait, could i just put this into the units init field you reckon?
    Last edited by McSpeed; Mar 4 2012 at 16:09.

  7. #7
    Quote Originally Posted by McSpeed View Post
    .... oh wait, could i just put this into the units init field you reckon?
    idk, since I am not sure it would be "reinited" properly each time someone JIPs.

    The trouble, as far as i see it, there appears no easy way to reference the unit object within the scope of onPlayerConnected script
    The variables which are passed to "checkslot.sqf" don't reference that unit object but strings with the player specific data, and with this data I don't figure a script command that is able to retrieve that object.

    I am assuming those "wslot25"/"wslot41"/etc variables are the names as defined in the editor. You could try the following:

    Code:
    _uid = _this select 0;
    _name = _this select 1;
    
    //list of units (editor placed)
    _slotsA = [wslot25,wslot26,wslot27,wslot28];
    _slotsB = [wslot41,wslot42,wslot43,wslot44];
    
    //list of UIDs on A slots
    _allowedAUIDs = ["123456","654321"];
    
    //list of UIDs on B slots
    _allowedBUIDs = ["987654","456789"];
    
    {
    	if (isPlayer _x) then {
    		{
    			if (_uid != _x) then {
    				serverCommand Format["#kick %1",_name];
    			};
    		}forEach _allowedAUIDs;
    	};
    }forEach _slotsA;
    
    {
    	if (isPlayer _x) then {
    		{
    			if (_uid != _x) then {
    				serverCommand Format["#kick %1",_name];
    			};
    		}forEach _allowedBUIDs;
    	};
    }forEach _slotsB;
    };
    As ugly as it gets, this would make all checks independently of current slot being occupied, but might work.
    Last edited by gammadust; Mar 4 2012 at 17:15. Reason: code update

  8. #8
    Sergeant
    Join Date
    Feb 17 2012
    Location
    Gaillimh, Galway, Ireland, Ireland
    Posts
    106
    wow, i am actually starting to understand this stuff

    will try this now, though i am not sure how JIP will be affected by this

  9. #9
    now with narrowed down checks:

    Code:
    _uid = _this select 0;
    _name = _this select 1;
    
    // get a reference of the current object (unit) being connected
    _unit = objNull;
    {
    	if ((isPlayer _x) and (_uid == getPlayerUID _x)) then {
    		_unit = _x;
    	};
    }forEach playableUnits;
    
    //list of units (editor placed)
    _slotsA = [wslot25,wslot26,wslot27,wslot28];
    _slotsB = [wslot41,wslot42,wslot43,wslot44];
    //list of UIDs on A slots
    _allowedAUIDs = ["123456","654321"];
    //list of UIDs on B slots
    _allowedBUIDs = ["987654","456789"];
    
    {
    	if ((isPlayer _x) and (_unit == _x)) then {
    		{
    			if (_uid != _x) then {
    				serverCommand Format["#kick %1",_name];
    			};
    		}forEach _allowedAUIDs;
    	};
    }forEach _slotsA;
    
    {
    	if ((isPlayer _x) and (_unit == _x)) then {
    		{
    			if (_uid != _x) then {
    				serverCommand Format["#kick %1",_name];
    			};
    		}forEach _allowedBUIDs;
    	};
    }forEach _slotsB;
    };
    I suspect all this should be run whitin a isServer check like:

    Code:
    if (isServer) then {OnPlayerConnected "[_uid,_name] execVM ""checkslot.sqf""";};
    as i said, don't really know the intricacies of multiplayer scripting.
    Last edited by gammadust; Mar 4 2012 at 18:13.

  10. #10
    Sergeant
    Join Date
    Feb 17 2012
    Location
    Gaillimh, Galway, Ireland, Ireland
    Posts
    106
    hmmm, thanks a lot
    but alas no joy.

    i am somewhat surprised no one else finds interest in this.
    i would have thought some mp scripters would be around and may be able to help out.

    guess i am doomed to appear to be the power hungry admin from hell and kick players rather than prevent them from being where they shouldnt be.

Page 1 of 2 12 LastLast

Posting Permissions

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