kuplion

[HELP] Server side UID storage..

10 posts in this topic

I'm working on a little serverside PBO that stores the UID of my admin and moderators so they don't have to be stored insecurely in the mission file. (It ties in with my Custom Loadouts as we spawn with Police Uniform when in admin mode)

I'm attempting to call the array from the mission file but it just does not work. If I store the UID in the mission file the check succeeds and the script continues. I've run this as a mission file addon, and through the InfiSTAR debugger and neither works.

The non-working dummy code I'm using to test it:

_requestingPlayer = player;

_getAdminUID = getArray (configFile >> "CfgUID" >> "adminUID");

if ((getPlayerUID _requestingPlayer) in _getAdminUID) then

{

["ErrorTitleOnly", ["Yay the UID test worked!!"]] call ExileClient_gui_toaster_addTemplateToast;

}

else

{

["ErrorTitleOnly", ["Boo the UID test failed!!"]] call ExileClient_gui_toaster_addTemplateToast;

};

The working dummy code:

_requestingPlayer = player;

_getAdminUID = ["1234567890"];

if ((getPlayerUID _requestingPlayer) in _getAdminUID) then

{

["ErrorTitleOnly", ["Yay the UID test worked!!"]] call ExileClient_gui_toaster_addTemplateToast;

}

else

{

["ErrorTitleOnly", ["Boo the UID test failed!!"]] call ExileClient_gui_toaster_addTemplateToast;

};

The PBO config.cpp:

class CfgPatches
{
	class a3_UID
	{
		requiredVersion = 0.1;
		requiredAddons[] = {};
		units[] = {};
		weapons[] = {};
		magazines[] = {};
		ammo[] = {};
	};
};

class CfgUID
{
  	adminUID[] =
  	{
		"1234567890" // kuplion
  	};
	
	modUID[] = 
	{
		"123", // Rompastomp
		"456", // Nalwoir
		"789", // Xport
		"000" // Nikuya
  	};
};

The PBO prefix:

a3_UID

What am I missing here?

Share this post


Link to post
Share on other sites

ConfigFile only pulls the configFile that is local to the client (this excludes mission config) that is running the command. Since that PBO is being ran on the server, the client doesn't know it exists and therefore, cannot access its information. 

If that command was ran on the server, it would work fine and pull that array. Which you could look into moving that script to the server and utilize onPlayerConnected or createBambi/player_database_load so you don't even have to worry about sending data back and forth. Just a thought. :) 
Otherwise, if you need it to be in the mission file, the way around that is the use of the command, publicVariable: https://community.bistudio.com/wiki/publicVariable
You would have to grab the array on the server, and publicVariable it so any connecting clients would have the information. Then check to see if the UID is in that array. 

 

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement
9 minutes ago, WolfkillArcadia said:

ConfigFile only pulls the configFile that is local to the client (this excludes mission config) that is running the command. Since that PBO is being ran on the server, the client doesn't know it exists and therefore, cannot access its information. 

If that command was ran on the server, it would work fine and pull that array. Which you could look into moving that script to the server and utilize onPlayerConnected or createBambi/player_database_load so you don't even have to worry about sending data back and forth. Just a thought. :) 
Otherwise, if you need it to be in the mission file, the way around that is the use of the command, publicVariable: https://community.bistudio.com/wiki/publicVariable
You would have to grab the array on the server, and publicVariable it so any connecting clients would have the information. Then check to see if the UID is in that array. 

 

Thank you for the reply. :)


The actual changes are going in to createBambi/player_database_load, so does that mean it's actually just my dummy code being executed locally that is the issue and that if put in place correctly (serverside sqf) it'll work correctly?

Share this post


Link to post
Share on other sites
7 minutes ago, kuplion said:

Thank you for the reply. :)


The actual changes are going in to createBambi/player_database_load, so does that mean it's actually just my dummy code being executed locally that is the issue and that if put in place correctly (serverside sqf) it'll work correctly?

Pretty much.

You won't be able to run the player command on the server, but you will be able to access your configFile from there. 

Share this post


Link to post
Share on other sites
6 minutes ago, WolfkillArcadia said:

Pretty much.

You won't be able to run the player command on the server, but you will be able to access your configFile from there. 

Yeah, I figured that much. I was using _requestingPlayer as defined in the server files but changed it to player to run locally. Little did I realise that was the issue. lol Thank you again.

Share this post


Link to post
Share on other sites

Posted (edited)

2 hours ago, WolfkillArcadia said:

No problem. 

So just to double check, using this as an override for ExileServer_object_player_createBambi.sqf will work as intended when I drop the UID PBO into the server? Or should I replace it in the server PBO? (I normally keep server file overrides in the mission file to keep it all tidy)

Spoiler

***SNIP***

 

 

Edited by kuplion

Share this post


Link to post
Share on other sites

Posted (edited)

23 minutes ago, kuplion said:

So just to double check, using this as an override for ExileServer_object_player_createBambi.sqf will work as intended when I drop the UID PBO into the server? Or should I replace it in the server PBO? (I normally keep server file overrides in the mission file to keep it all tidy)

  Reveal hidden contents


/**
 * ExileServer_object_player_createBambi
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_sessionID","_requestingPlayer","_spawnLocationMarkerName","_bambiPlayer","_accountData","_direction","_position","_spawnAreaPosition","_spawnAreaRadius","_clanID","_clanData","_clanGroup","_player","_devFriendlyMode","_devs","_parachuteNetID","_spawnType","_parachuteObject","_bambiUniforms","_bambiHeadgear","_bambiNavItem","_bambiFood","_bambiDrink","_adminUID","_bambiWeapon","_bambiMagazine", "_bambiMagazineSelection","_bambiChemlights"];
_sessionID = _this select 0;
_requestingPlayer = _this select 1;
_spawnLocationMarkerName = _this select 2;
_bambiPlayer = _this select 3;
_accountData = _this select 4;
_direction = random 360;
if ((count ExileSpawnZoneMarkerPositions) isEqualTo 0) then 
{
	_position = call ExileClient_util_world_findCoastPosition;
	if ((toLower worldName) isEqualTo "namalsk") then 
	{
		while {(_position distance2D [76.4239, 107.141, 0]) < 100} do 
		
{
			_position = call ExileClient_util_world_findCoastPosition;
		};
	};
}
else 
{
	_spawnAreaPosition = getMarkerPos _spawnLocationMarkerName;
	_spawnAreaRadius = getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "spawnZoneRadius");
	_position = [_spawnAreaPosition, _spawnAreaRadius] call ExileClient_util_math_getRandomPositionInCircle;
	while {surfaceIsWater _position} do 
	{
		_position = [_spawnAreaPosition, _spawnAreaRadius] call ExileClient_util_math_getRandomPositionInCircle;
	};
};
_name = name _requestingPlayer;
_clanID = (_accountData select 3);
if !((typeName _clanID) isEqualTo "SCALAR") then
{
	_clanID = -1;
	_clanData = [];
}
else
{
	_clanData = missionNamespace getVariable [format ["ExileServer_clan_%1",_clanID],[]];
	if(isNull (_clanData select 5))then
	{
		_clanGroup = createGroup independent;
		_clanData set [5,_clanGroup];
		_clanGroup setGroupIdGlobal [_clanData select 0];
		missionNameSpace setVariable [format ["ExileServer_clan_%1",_clanID],_clanData];
	}
	else
	{
		_clanGroup = (_clanData select 5);
	};
	[_player] joinSilent _clanGroup;
};
_bambiPlayer setPosATL [_position select 0,_position select 1,0];
_bambiPlayer disableAI "FSM";
_bambiPlayer disableAI "MOVE";
_bambiPlayer disableAI "AUTOTARGET";
_bambiPlayer disableAI "TARGET";
_bambiPlayer disableAI "CHECKVISIBLE";
_bambiPlayer setDir _direction;
_bambiPlayer setName _name;
_bambiPlayer setVariable ["ExileMoney", 0, true]; 
_bambiPlayer setVariable ["ExileScore", (_accountData select 0)];
_bambiPlayer setVariable ["ExileKills", (_accountData select 1)];
_bambiPlayer setVariable ["ExileDeaths", (_accountData select 2)];
_bambiPlayer setVariable ["ExileClanID", _clanID];
_bambiPlayer setVariable ["ExileClanData", _clanData];
_bambiPlayer setVariable ["ExileHunger", 100];
_bambiPlayer setVariable ["ExileThirst", 100];
_bambiPlayer setVariable ["ExileTemperature", 37];
_bambiPlayer setVariable ["ExileWetness", 0];
_bambiPlayer setVariable ["ExileAlcohol", 0]; 
_bambiPlayer setVariable ["ExileName", _name]; 
_bambiPlayer setVariable ["ExileOwnerUID", getPlayerUID _requestingPlayer]; 
//_bambiPlayer setVariable ["ExileIsBambi", true];
//_bambiPlayer setVariable ["ExileXM8IsOnline", false, true];
_bambiPlayer setVariable ["ExileLocker", (_accountData select 4), true];
_devFriendlyMode = getNumber (configFile >> "CfgSettings" >> "ServerSettings" >> "devFriendyMode");
if (_devFriendlyMode isEqualTo 1) then 
{
	_devs = getArray (configFile >> "CfgSettings" >> "ServerSettings" >> "devs");
	{
		if ((getPlayerUID _requestingPlayer) isEqualTo (_x select 0))exitWith 
		
{
			if((name _requestingPlayer) isEqualTo (_x select 1))then
			
{
				_bambiPlayer setVariable ["ExileMoney", 500000, true];
				_bambiPlayer setVariable ["ExileScore", 100000];
			};
		};
	}
	forEach _devs;
};
_parachuteNetID = "";
_bambiUniforms = ["U_C_Journalist","U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_salmon","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poor_1","U_C_Poor_2","U_C_Poor_shorts_1","U_C_Scientist","U_OrestesBody","U_Rangemaster","U_NikosAgedBody","U_NikosBody","U_Competitor","U_I_G_Story_Protagonist_F","Exile_Uniform_Woodland","U_C_HunterBody_grn","U_IG_Guerilla1_1","U_IG_Guerilla2_1","U_IG_Guerilla2_2","U_IG_Guerilla2_3","U_IG_Guerilla3_1","U_BG_Guerilla2_1","U_IG_Guerilla3_2","U_BG_Guerrilla_6_1","U_BG_Guerilla1_1","U_BG_Guerilla2_2","U_BG_Guerilla2_3","U_BG_Guerilla3_1","U_I_G_resistanceLeader_F","U_B_survival_uniform","U_B_HeliPilotCoveralls","U_I_HeliPilotCoveralls","U_B_PilotCoveralls","U_I_pilotCoveralls","U_O_PilotCoveralls","Exile_Uniform_BambiOverall","U_B_T_Soldier_F","U_B_T_Soldier_AR_F","U_B_T_Soldier_SL_F","U_B_CTRG_Soldier_F","U_B_CTRG_Soldier_2_F","U_B_CTRG_Soldier_3_F","U_B_GEN_Soldier_F","U_O_T_Soldier_F","U_O_T_Officer_F","U_O_V_Soldier_Viper_F","U_O_V_Soldier_Viper_hex_F","U_I_C_Soldier_Para_1_F","U_I_C_Soldier_Para_2_F","U_I_C_Soldier_Para_3_F","U_I_C_Soldier_Para_4_F","U_I_C_Soldier_Para_5_F","U_I_C_Soldier_Bandit_1_F","U_I_C_Soldier_Bandit_2_F","U_I_C_Soldier_Bandit_3_F","U_I_C_Soldier_Bandit_4_F","U_I_C_Soldier_Bandit_5_F","U_I_C_Soldier_Camo_F","U_C_man_sport_1_F","U_C_man_sport_2_F","U_C_man_sport_3_F","U_C_Man_casual_1_F","U_C_Man_casual_2_F","U_C_Man_casual_3_F","U_C_Man_casual_4_F","U_C_Man_casual_5_F","U_C_Man_casual_6_F","U_B_CTRG_Soldier_urb_1_F","U_B_CTRG_Soldier_urb_2_F","U_B_CTRG_Soldier_urb_3_F"] call BIS_fnc_selectRandom;
_bambiHeadgear = ["H_Cap_blk","H_Cap_blk_Raven","H_Cap_blu","H_Cap_brn_SPECOPS","H_Cap_grn","H_Cap_headphones","H_Cap_khaki_specops_UK","H_Cap_oli","H_Cap_press","H_Cap_red","H_Cap_tan","H_Cap_tan_specops_US","H_Watchcap_blk","H_Watchcap_camo","H_Watchcap_khk","H_Watchcap_sgg","H_MilCap_blue","H_MilCap_dgtl","H_MilCap_mcamo","H_MilCap_ocamo","H_MilCap_oucamo","H_MilCap_rucamo","H_Bandanna_camo","H_Bandanna_cbr","H_Bandanna_gry","H_Bandanna_khk","H_Bandanna_khk_hs","H_Bandanna_mcamo","H_Bandanna_sgg","H_Bandanna_surfer","H_Booniehat_dgtl","H_Booniehat_dirty","H_Booniehat_grn","H_Booniehat_indp","H_Booniehat_khk","H_Booniehat_khk_hs","H_Booniehat_mcamo","H_Booniehat_tan","H_Hat_blue","H_Hat_brown","H_Hat_camo","H_Hat_checker","H_Hat_grey","H_Hat_tan","H_StrawHat","H_StrawHat_dark","H_Beret_02","H_Beret_blk","H_Beret_blk_POLICE","H_Beret_brn_SF","H_Beret_Colonel","H_Beret_grn","H_Beret_grn_SF","H_Beret_ocamo","H_Beret_red","H_Shemag_khk","H_Shemag_olive","H_Shemag_olive_hs","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan","H_TurbanO_blk","H_Helmet_Skate","H_MilCap_tna_F","H_MilCap_ghex_F","H_Booniehat_tna_F","H_Beret_gen_F","H_MilCap_gen_F"] call BIS_fnc_selectRandom;
_bambiNavItem = ["ItemMap","ItemCompass","ItemGPS"] call BIS_fnc_selectRandom;
_bambiFood = ["Exile_Item_EMRE","Exile_Item_GloriousKnakworst","Exile_Item_Surstromming","Exile_Item_SausageGravy","Exile_Item_Catfood","Exile_Item_ChristmasTinner","Exile_Item_BBQSandwich","Exile_Item_Dogfood","Exile_Item_BeefParts","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_SeedAstics","Exile_Item_Raisins","Exile_Item_Moobar"] call BIS_fnc_selectRandom;
_bambiDrink = ["Exile_Item_PlasticBottleCoffee","Exile_Item_PowerDrink","Exile_Item_PlasticBottleFreshWater","Exile_Item_Beer","Exile_Item_EnergyDrink","Exile_Item_MountainDupe"] call BIS_fnc_selectRandom;
_bambiChemlights = ["Chemlight_green","Chemlight_yellow","Chemlight_red","Chemlight_blue"] call BIS_fnc_selectRandom;
_adminUID = getArray (configFile >> "CfgUID" >> "adminUID");
//_bambiWeapon = ["hgun_PDW2000_F","hgun_ACPC2_F","hgun_P07_F","hgun_Pistol_heavy_02_F","hgun_Rook40_F"] call BIS_fnc_selectRandom;
//_bambiMagazineSelection = getArray (configFile >> "CfgWeapons" >> _bambiWeapon >> "magazines") call BIS_fnc_selectRandom;
//_bambiMagazine = _bambiMagazineSelection;
;
if ((getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "parachuteSpawning")) isEqualTo 1) then
{
	_position set [2, getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "parachuteDropHeight")]; 
	if ((getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "haloJump")) isEqualTo 1) then
	{
		_bambiPlayer addBackpackGlobal "B_Parachute";
		_bambiPlayer setPosATL _position;
		_spawnType = 2;
	}
	else 
	{
		_parachuteObject = createVehicle ["Steerable_Parachute_F", _position, [], 0, "CAN_COLLIDE"];
		_parachuteObject setDir _direction;
		_parachuteObject setPosATL _position;
		_parachuteObject enableSimulationGlobal true;
		_parachuteNetID = netId _parachuteObject;
		_spawnType = 1;
	};
}
else
{
	_spawnType = 0;
};
// Admin Loadout
if ((getPlayerUID _requestingPlayer) in _adminUID) then

{
	
	_bambiPlayer forceAddUniform "U_B_GEN_Commander_F";
	_bambiPlayer addVest "V_TacVest_gen_F";
	_bambiPlayer addHeadgear "H_Beret_gen_F";
	//_bambiPlayer addItem "ItemGPS";
	//_bambiPlayer assignItem "ItemGPS";
	_bambiPlayer linkItem "ItemGPS";
	//_bambiPlayer addItem "Exile_Item_XM8";
	//_bambiPlayer assignItem "Exile_Item_XM8";
	_bambiPlayer linkItem "Exile_Item_XM8";
	//_bambiPlayer addItem "ItemCompass";
	//_bambiPlayer assignItem "ItemCompass";
	_bambiPlayer linkItem "ItemCompass";
	//_bambiPlayer addItem "ItemMap";
	//_bambiPlayer assignItem "ItemMap";
	_bambiPlayer linkItem "ItemMap";
	_bambiPlayer addItem "Exile_Item_PlasticBottleCoffee";
	_bambiPlayer addItem "Exile_Item_EMRE";
	_bambiPlayer setVariable ["ExileIsBambi", false];
	_bambiPlayer setVariable ["ExileXM8IsOnline", true, true];
	
}

// Player Loadout
else

{
    
	_bambiPlayer addHeadgear _bambiHeadgear;
	_bambiPlayer forceAddUniform _bambiUniforms;
	_bambiPlayer addItem _bambiDrink;
	_bambiPlayer addItem _bambiFood;
	//_bambiPlayer addItem _bambiMagazine;
	//_bambiPlayer addItem _bambiMagazine;
	//_bambiPlayer addWeapon _bambiWeapon;
	//_bambiPlayer addItem _bambiNavItem;
	//_bambiPlayer assignItem _bambiNavItem;
	_bambiPlayer linkItem _bambiNavItem;
	_bambiPlayer addItem _bambiChemlights;
	//_bambiPlayer addItem "Exile_Item_XM8";
	//_bambiPlayer assignItem "Exile_Item_XM8";
	_bambiPlayer linkItem "Exile_Item_XM8";
	_bambiPlayer setVariable ["ExileIsBambi", true];
	_bambiPlayer setVariable ["ExileXM8IsOnline", true, true];
	
};
_bambiPlayer addMPEventHandler ["MPKilled", {_this call ExileServer_object_player_event_onMpKilled}];
_bambiPlayer call ExileServer_object_player_database_insert;
_bambiPlayer call ExileServer_object_player_database_update;
[
	_sessionID, 
	"createPlayerResponse", 
	[
		_bambiPlayer, 
		_parachuteNetID, 
		str (_accountData select 0),
		(_accountData select 1),
		(_accountData select 2),
		100,
		100,
		0,
		(getNumber (configFile >> "CfgSettings" >> "BambiSettings" >> "protectionDuration")) * 60, 
		_clanData,
		_spawnType
	]
] 
call ExileServer_system_network_send_to;
[_sessionID, _bambiPlayer] call ExileServer_system_session_update;
true

 

 

It will work fine via an overwrite because the server will still run that code. 

Edited by WolfkillArcadia
1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.