NFlight

Player Slot Restrictions

18 posts in this topic

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

.... 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
code update

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

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