Jump to content

Recommended Posts

can anyone give me some code for a PlayerID based whitelist?

Thanks!

This will work:

playerwhitelist = ["123","456","789"];
if(getplayerUID player in playerwhitelist) then 
{
      //code here
};

replace the numbers in the array with the player IDs, and encase each player ID in quotes, and seperate each player ID in quotes with a comma as done above.

  • Like 2

Share this post


Link to post
Share on other sites

Here are two examples for you that I use in my missions.

VEHICLE WHITELIST

/* 
VehicleWhitelist.sqf by Kahna

The player UID is a 17 digit number found in the profile tab. 

Initially call this script in the Init.sqf and then include it in whatever script you use to respawn vehicles,
otherwise the respawned vehicle will not have the Whitelist script applied to it.

You can adapt this for vehicles and ships as well as using vehicle variable names in the restricted array if you desire to allow public players to operate the same type of aircraft that are reserved for players in the UID List (i.e. Wipeout 1 for Public, Wipeout 2 for Members, etc)

*/

_UIDList = 
[
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here  */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here  */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here  */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here*/
];

// Types of Players allowed to operate aircraft (i.e. PilotCheck). Omit this if you want anyone in the UID List to be able to fly. //
_AirRoles = ["B_Helipilot_F"];

// Types of Aircraft to be restricted. //
_RestrictAir = ["B_Heli_Attack_01_F"];

while {true} do {
waitUntil {sleep 0.5; alive player};
if (!((getPlayerUID player) in _UIDList) && ((typeof player) in _AirRoles)) then {
	private "_v";
	while {alive player} do {
		waitUntil {sleep 0.5; vehicle player != player};
		_v = vehicle player;
     _t = typeof _v;
		if (_t in _RestrictAir) then {
			if (driver _v == player) then {
				player action ["eject", _v];
				waitUntil {sleep 0.5; vehicle player == player};
				player action ["engineOff", _v];
				hint "You are not authorized to operate this aircraft!";
			};
		};
	};
} else {
	waitUntil {sleep 0.5; !alive player};
};
};

RESERVED SLOT

/* 
ReservedSlot.sqf by Kahna

Initially call this script in the Init.sqf and then include it in whatever script you use to respawn players,
otherwise the respawned player will not have the Reserved Slot script applied to it.

*/

while {true} do 
{
private ["_reserved_units", "_reserved_uids", "_uid"];

waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
waitUntil {(getPlayerUID player) != ""};

// Variable Name of the Player Character to be restricted. //
_reserved_units = [Reserved01];

// The player UID is a 17 digit number found in the profile tab. //
_reserved_uids = 
[
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */
];

// Stores the connecting player's UID //
_uid = getPlayerUID player;


if ((player in _reserved_units)&& !(_uid in _reserved_uids)) then 
{
  titleText ["", "BLACK OUT"];
  disableUserInput true;
  hint "You are in a reserved slot! You will be kicked to the lobby in 15 seconds!";
  sleep 5;
  hint "You are in a reserved slot! You will be kicked to the lobby in 10 seconds!";
  sleep 5;
  hint "You are in a reserved slot! You will be kicked to the lobby in 5 seconds!";
  sleep 5;
  titleText ["", "BLACK IN"];
  disableUserInput false;
  failMission "end1";
  	};  
};

  • Like 1

Share this post


Link to post
Share on other sites

How do i get this to work? is the 123 the ingame player slot name? like player 1 then code here is "4664624622" // some random uid
 

playerwhitelist = ["player1","player2","player3"];
if(getplayerUID player in playerwhitelist) then 
{
"4624624624621" // some whitelisted player
};

Share this post


Link to post
Share on other sites

Password your server.  Or use Battleye to whitelist.  Both are much better ideas than an SQF mission based whitelist.

 

Your code is backwards though, just leave it as austin medic had it:

playerwhitelist = ["123456","1234567","12345678"];

// This checks to see if the steamID of the player (getplayerUID player) is in the playerwhitelist array.
if(getplayerUID player in playerwhitelist) then {
       // Friendly code here, you match.
       hint format["Welcome to the server %1!", name player];

} else {
       // Unfriendly code here, you don't match, so kick them here or something.
       hint format["You're not welcome here you should know, %1!", name player];

};
  • Like 1

Share this post


Link to post
Share on other sites

oh so the playerwhitelist = ["123456","1234567","12345678"]; is  where i put the uid? also where do i put this code into an sqf file then call it through init,sqf?

Share this post


Link to post
Share on other sites

Yup, exactly!  Not sure where the best place for it would be though, either a pre-init onPlayerConnected eventHandler or if just the top of init.sqf or initPlayerLocal.sqf.

Share this post


Link to post
Share on other sites

They both do the same thing tbh it worked in init.sqf and initplayerlocal for me.

Share this post


Link to post
Share on other sites

Ok i put my uid in and it detects me and says the friendly message, but it displays the unfriendly message to anyone who doesn't have the uid in the whitelist... but it doesn't kick me even tho my uid isn't added?? 

Share this post


Link to post
Share on other sites

Can you post your "not in the UID list" code please?

it's working now for me i'm using this

/* 
ReservedSlot.sqf by Kahna

Initially call this script in the Init.sqf and then include it in whatever script you use to respawn players,
otherwise the respawned player will not have the Reserved Slot script applied to it.

*/

while {true} do 
{
private ["_reserved_units", "_reserved_uids", "_uid"];

waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
waitUntil {(getPlayerUID player) != ""};

// Variable Name of the Player Character to be restricted. //
_reserved_units = [Reserved01];

// The player UID is a 17 digit number found in the profile tab. //
_reserved_uids = 
[
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */,
"UIDXXXXXXXXXXXXXX"/* Add Player Name Here */
];

// Stores the connecting player's UID //
_uid = getPlayerUID player;


if ((player in _reserved_units)&& !(_uid in _reserved_uids)) then 
    {
titleText ["", "BLACK OUT"];
disableUserInput true;
hint "You are in a reserved slot! You will be kicked to the lobby in 15 seconds!";
sleep 5;
hint "You are in a reserved slot! You will be kicked to the lobby in 10 seconds!";
sleep 5;
hint "You are in a reserved slot! You will be kicked to the lobby in 5 seconds!";
sleep 5;
titleText ["", "BLACK IN"];
disableUserInput false;
failMission "end1";
    }; 
};

Share this post


Link to post
Share on other sites

use this

"end1" call BIS_fnc_endMission;

instead of this

failMission "end1";

failMission

 

To maintain Arma 3 visual style, it's recommended to use BIS_fnc_endMission instead.

 

idk if that will solve the problem but I saw that in BIKI

 

 

I feel like on a Groundhog Day

Share this post


Link to post
Share on other sites

idk if that will solve the problem but I saw that in BIKI

 

 

Both should work, but all he's doing is kicking a player off.  He's already punished them enough by disabling their input for 15 seconds with redundant messages preventing them from backing out themselves, making them wait through the flashy mission complete animation seems just a bit much. :)

  • Like 1

Share this post


Link to post
Share on other sites

i replaced the code like you said it does same its not saying you will get kicked in 15 seconds but i cant backout also your code didn't change anything it's doing exact same but thanks anyways

Share this post


Link to post
Share on other sites

Can you post your "not in the UID list" code please?

if ((player in _reserved_units)&& !(_uid in _reserved_uids)) then
    {
   titleText ["", "BLACK OUT"];
   disableUserInput true;
   hint "You are in a reserved slot! You will be kicked to the lobby in 15 seconds!";
   sleep 5;
   hint "You are in a reserved slot! You will be kicked to the lobby in 10 seconds!";
   sleep 5;
   hint "You are in a reserved slot! You will be kicked to the lobby in 5 seconds!";
   sleep 5;
   titleText ["", "BLACK IN"];
   disableUserInput false;
   "end1" call BIS_fnc_endMission;
    };  
 };

Share this post


Link to post
Share on other sites

did u change this to ur needs?:

// Variable Name of the Player Character to be restricted. //
_reserved_units = [Reserved01];

maybe like this:

// Variable Name of the Player Character to be restricted. //
_reserved_units = [man1, man2, man3];

man1 - 3 r the variable names of ur player entities. u ve to name them in editor.

Share this post


Link to post
Share on other sites

did u change this to ur needs?:

// Variable Name of the Player Character to be restricted. //
_reserved_units = [Reserved01];

maybe like this:

// Variable Name of the Player Character to be restricted. //
_reserved_units = [man1, man2, man3];

man1 - 3 r the variable names of ur player entities. u ve to name them in editor.

Yes i already changed that if i go into the slot without my uid it downloads mission takes me to the briefing then i can't do anything i cant backout or cancel but if my uid is in the code it allows me to play it's supposed to say kicking in 15 seconds then kick but it doesn't it just freezes you and that's it...

Share this post


Link to post
Share on other sites

post ur complete current script please and tell us how and where it is called/executed.

Share this post


Link to post
Share on other sites

post ur complete current script please and tell us how and where it is called/executed.

For sake of it i'll leave my uid out of the code as i want it to show message to kick me as my uid isn't added.

 

full code i put this into initplayerlocal.sqf that's it for that, In mission i have 4 characters for each team bluefor opfor independent as you can see in the _reserved_units

 

if (!isServer) then
{
"BIS_fnc_MP_packet" addPublicVariableEventHandler compileFinal preprocessFileLineNumbers "server\antihack\filterExecAttempt.sqf";
};


while {true} do
{
private ["_reserved_units", "_reserved_uids", "_uid"];


waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
waitUntil {(getPlayerUID player) != ""};


// Variable Name of the Player Character to be restricted. //
_reserved_units = [Reserved01, Reserved02, Reserved03, Reserved04, Reservedred01, Reservedred02, Reservedred03, Reservedred04, Reservedgreen01, Reservedgreen02, Reservedgreen03, Reservedgreen04];


// The player UID is a 17 digit number found in the profile tab. //
_reserved_uids =
[
"XXXXXXXXXXXXXXXXX"/* Add Player Name Here */,
"XXXXXXXXXXXXXXXXX"/* Add Player Name Here */,
"XXXXXXXXXXXXXXXXX"/* Add Player Name Here */
];


// Stores the connecting player's UID //
_uid = getPlayerUID player;




if ((player in _reserved_units)&& !(_uid in _reserved_uids)) then
    {
   titleText ["", "BLACK OUT"];
   disableUserInput true;
   hint "You are in a reserved slot! You will be kicked to the lobby in 15 seconds!";
   sleep 5;
   hint "You are in a reserved slot! You will be kicked to the lobby in 10 seconds!";
   sleep 5;
   hint "You are in a reserved slot! You will be kicked to the lobby in 5 seconds!";
   sleep 5;
   titleText ["", "BLACK IN"];
   disableUserInput false;
   failMission "end1";
    };  
 };

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

×