Jump to content

Photo
- - - - -

Player Slot Restrictions


  • Please log in to reply
17 replies to this topic
Thread Starter
NFlight
NFlight

    Newbie

  • Members
  • 1 posts

#1

Posted 11 January 2012 - 00:33

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.

McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#2

Posted 04 March 2012 - 01:06

i would be interested in this too. did you find a solution?

gammadust
gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

#3

Posted 04 March 2012 - 01:44

maybe this thread may help... check Demonized post too.

McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#4

Posted 04 March 2012 - 13:47

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


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

and
created a checkslot.sqf with:
_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.

//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...

Edited by McSpeed, 04 March 2012 - 15:31.


gammadust
gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

#5

Posted 04 March 2012 - 15:18

I totally missed the original question, sry.

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

_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.

McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#6

Posted 04 March 2012 - 15:43

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 :D


.... oh wait, could i just put this into the units init field you reckon?

Edited by McSpeed, 04 March 2012 - 16:09.


gammadust
gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

#7

Posted 04 March 2012 - 16:59

.... 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:

_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.

Edited by gammadust, 04 March 2012 - 17:15.
code update


McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#8

Posted 04 March 2012 - 17:52

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

gammadust
gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

#9

Posted 04 March 2012 - 18:09

now with narrowed down checks:

_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:

if (isServer) then {OnPlayerConnected "[_uid,_name] execVM ""checkslot.sqf""";};

as i said, don't really know the intricacies of multiplayer scripting.

Edited by gammadust, 04 March 2012 - 18:13.


McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#10

Posted 05 March 2012 - 12:44

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.

kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

#11

Posted 05 March 2012 - 15:28

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.


Or get to know the pub players on your server and work with them instead of trying to exclude them. If you can't do that just password your server. Open, organized and accepting teamplay does wonders over trying to restrict people from doing anything specific.

Or run missions instead of Domi. Pubbers hate missions. :)

kremator
kremator

    Major

  • Members
  • 7526 posts

#12

Posted 05 March 2012 - 17:00

Or run missions instead of Domi.


Amen.

McSpeed
McSpeed

    Sergeant

  • Members
  • 106 posts

#13

Posted 05 March 2012 - 17:29

hehe, yes indeed. we do both.
missions on pw server and open sessions on public server.
but sometimes one of our squadS likes to run along on the dom to have fun and /or recruit pubbies.
to this end we like to have a squad reserved for those guys.
I just didnt think it that difficult to achieve... but then, this is arma... should have guessed :D

Edited by McSpeed, 05 March 2012 - 17:41.


Xeno
Xeno

    ACE Team Leader

  • Members
  • 1814 posts

#14

Posted 05 March 2012 - 19:15

hehe, yes indeed. we do both.
missions on pw server and open sessions on public server.
but sometimes one of our squadS likes to run along on the dom to have fun and /or recruit pubbies.
to this end we like to have a squad reserved for those guys.
I just didnt think it that difficult to achieve... but then, this is arma... should have guessed :D

Just check x_reservedslot.sqf in the x_client folder. It is made for reserved admin slots but should also work (with a few changes) for restricting pilot slots.

Edit: I've added a second system for the next version where you can limit whatever slots you like based on UIDs (though no idea when it'll be available).

Xeno

Edited by Xeno, 05 March 2012 - 20:08.

[SIZE=1][/SIZE]

stick_hogue
stick_hogue

    Private First Class

  • Members
  • 17 posts

#15

Posted 02 July 2012 - 18:29

It's been a long time since I messed with this on Limited Assets, but I think I had it working as follows:

Passing _name into an onplayerdisconnected.sqf script:

_connectedplayername = _this select 0;

if (_connectedplayername == (name playerAssault_1)) then {
playerAssault_1 setvariable ["lastconnectedplayername", _connectedplayername, true];
};
if (_connectedplayername == (name playerAssault_2)) then {
playerAssault_2 setvariable ["lastconnectedplayername", _connectedplayername, true];
};
if (_connectedplayername == (name playerAssault_3)) then {
playerAssault_3 setvariable ["lastconnectedplayername", _connectedplayername, true];
};
//etc. for each playable slot

I also passed _name into my onplayerdisconnected script and did stuff like this:

_disconnectedplayername = _this select 0;
if (_disconnectedplayername == (playerAssault_1 getvariable "lastconnectedplayername")) then {
_disconnectedunit = playerAssault_1;
Assault1teamkilled = false;
publicvariable "Assault1teamkilled";
};
if (_disconnectedplayername == (playerAssault_2 getvariable "lastconnectedplayername")) then {
_disconnectedunit = playerAssault_2;
Assault2teamkilled = false;
publicvariable "Assault2teamkilled";
};
//etc. for all playable slots
dostop _disconnectedplayername;
//etc.

(This was back when I was still using publicvariable and transitioning to the "new" setvariable/getvariable commands.)

hope this helps,
Stick

Mathiask1
Mathiask1

    Corporal

  • Members
  • 80 posts

#16

Posted 20 November 2012 - 07:18

well, i need some help with the same.

im creating a mission and i need all opfor slots restricted so only defined players can play them.

Any help?

TriGGa
TriGGa

    Corporal

  • Members
  • 73 posts

#17

Posted 10 December 2012 - 08:30

Anyone found a script that works for this?
Posted Image

TriGGa
TriGGa

    Corporal

  • Members
  • 73 posts

#18

Posted 28 December 2012 - 15:12

bumping
Posted Image