kuplion

[Solved] Change uniform based on UID.

15 posts in this topic

I'd like to be able to make my admin all spawn in with "Exile_Uniform_ExileCustoms" instead of "Exile_Uniform_BambiOverall" so they're easier to spot for other players out in the wild.

I'm tried  the UID Loadout at https://github.com/Jenartor/exile_uid-loadout/tree/master/uid_loadout but I can't seem to get it to add a new uniform. Can anyone help me out with this?

EDIT: Solved. Please see this post ( http://exile.majormittens.co.uk/topic/11226-solved-change-uniform-based-on-uid/#comment-63880 ) for the solution.

Edited by kuplion

Share this post


Link to post
Share on other sites

 

That code adds items.  You will want to add a line somewhere .. try at the bottom of that file that changes the uniform if the UID is true.
_bambiplayer forceadduniform  "Exile_Uniform_ExileCustoms".
 

Or you could just add that uniform into their items and they can put it on when they spawn.

Edited by ShootingBlanks

Share this post


Link to post
Share on other sites
Advertisement
21 minutes ago, ShootingBlanks said:

 

That code adds items.  You will want to add a line somewhere .. try at the bottom of that file that changes the uniform if the UID is true.
_bambiplayer forceadduniform  "Exile_Uniform_ExileCustoms".
 

Or you could just add that uniform into their items and they can put it on when they spawn.

I tried adding it as an item in a backpack so they could just equip it, but the backpack was added and the uniform was not. Thank you though, I'll give that other method a go.

Share this post


Link to post
Share on other sites

i always try to help answer questions when i am at work ... it beats actually working :D .. but the cellphone limits what information i can provide (should just keep quiet probably).

anyway .. on that code is this line right before the uid part

_bambiPlayer = _group createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];

 

so the player is created there , right below that and above the uid block you should be able to put in,something like this:

if ((getplayeruid _requestingplayer) in [adminuid,adminuid,etc]) then {

_bambiplayer forceadduniform "exile_uniform_exilecustoms";}

 

this would allow you to separate the admin from the normal player if you want

 

 

Edited by ShootingBlanks

Share this post


Link to post
Share on other sites
6 hours ago, ShootingBlanks said:

i always try to help answer questions when i am at work ... it beats actually working :D .. but the cellphone limits what information i can provide (should just keep quiet probably).

anyway .. on that code is this line right before the uid part

_bambiPlayer = _group createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];

 

so the player is created there , right below that and above the uid block you should be able to put in,something like this:

if ((getplayeruid _requestingplayer) in [adminuid,adminuid,etc]) then {

_bambiplayer forceadduniform "exile_uniform_exilecustoms";}

 

this would allow you to separate the admin from the normal player if you want

 

 

This worked perfectly, thank you so much.

Share this post


Link to post
Share on other sites

Step 0: Backup your 'Exile.Altis.pbo' mission PBO and your 'exile_server_config.pbo' before making any changes; that way if something goes wrong, you can just copy them back in and be up and running.

Step 1: UnPBO your mission file and create a folder called "uid_loadout" in it.

Step 2: Copy this code and save it as 'ExileServer_object_player_network_createPlayerRequest.sqf' in the 'uid_loadout' folder.

Spoiler

/**
 * ExileServer_object_player_network_createPlayerRequest
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 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","_parameters","_requestingPlayer","_spawnLocationMarkerName","_playerUID","_accountData","_bambiPlayer","_cargoType","_uidloadout","_uids","_uidLoadoutMode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_requestingPlayer = _sessionID call ExileServer_system_session_getPlayerObject;
_uidLoadoutMode = getNumber (configFile >> "UID_Loadout_Settings" >> "uidLoadoutMode");
if (_uidLoadoutMode isEqualTo 1) then
{
  _uids = getArray (configFile >> "UID_Loadout_Settings" >> "uids");
  if ((getPlayerUID _requestingPlayer) in _uids) then
  {
      _uidloadout = 1;
  }else
  {
      _uidloadout = 0;
  };
};
try
{
	if (isNull _requestingPlayer) then
	{
		throw format ["Session %1 requested a bambi character, but doesn't have a player object. Hacker or Monday?", _sessionID];
	};
	_spawnLocationMarkerName = _parameters select 0;
	_playerUID = getPlayerUID _requestingPlayer;
	if(_playerUID isEqualTo "")then
	{
		throw format ["Player: '%1' has no player UID. Arma/Steam Sucks!.",name _requestingPlayer];
	};
	_accountData = format["getAccountStats:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
	_group = createGroup independent;
	_bambiPlayer = _group createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];
  if (_uidloadout isEqualTo 1) then {
	_bambiplayer forceadduniform "Exile_Uniform_ExileCustoms"; // This forces this uniform on the admin
	_bambiPlayer addVest "V_TacVest_blk_POLICE"; // This adds a vest to the admin
	_bambiPlayer addHeadgear "H_Cap_police"; // This adds a cap to the admin
  	{
  		_cargoType = _x call ExileClient_util_cargo_getType;
  		switch (_cargoType) do
  		{
  			case 1: 	{ _bambiPlayer addItem _x; };
  			case 2: 	{ _bambiPlayer addWeaponGlobal _x; };
  			case 3: 	{ _bambiPlayer addBackpackGlobal _x; };
  			case 4:		{ _bambiPlayer linkItem _x; };
  			default 					{ _bambiPlayer addItem _x; };
  		};
  	}
    forEach getArray(configFile >> "UID_Loadout_Settings" >> "loadOut");
  } else {
    {
	_bambiPlayer addHeadgear "H_Cap_red"; // This changes the santa hat into a red cap
      _cargoType = _x call ExileClient_util_cargo_getType;
      switch (_cargoType) do
      {
        case 1: 	{ _bambiPlayer addItem _x; };
        case 2: 	{ _bambiPlayer addWeaponGlobal _x; };
        case 3: 	{ _bambiPlayer addBackpackGlobal _x; };
        case 4:		{ _bambiPlayer linkItem _x; };
        default 					{ _bambiPlayer addItem _x; };
      };
    }
    forEach getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "loadOut");
  };
	[_sessionID, _requestingPlayer, _spawnLocationMarkerName, _bambiPlayer, _accountData] call ExileServer_object_player_createBambi;
}
catch
{
	_exception call ExileServer_util_log;
};

 

Step 3: Open the 'config.cpp' in your mission and find "class CfgExileCustomCode" and paste the following into it.

Spoiler

	// Admin Loadout
	ExileServer_object_player_network_createPlayerRequest = "uid_loadout\ExileServer_object_player_network_createPlayerRequest.sqf";

 

Step 4: unPBO your 'exile_server_config.pbo' and add the following code at the end of 'config.cpp'.

Spoiler

  ///////////////////////////////////////////////////////////////////////
  // UID LOADOUT CONFIGURATION by Jenartor
  ///////////////////////////////////////////////////////////////////////
  class UID_Loadout_Settings{
  	uidLoadoutMode = 1;

  	uids[] =
  	{
		"1234567890", // Admin1
		"0987654321", // Admin2
		"1234509876" // Admin3
  	};

    // ItemList
  	loadOut[] =
  	{
  		"ItemMap", // These bits are the standard items I want my adminsto spawn with
  		"Exile_Item_XM8", // These bits are the standard items I want my admins to spawn with
  		"Exile_Item_PlasticBottleCoffee", // These bits are the standard items I want my admins to spawn with
		"Exile_Item_EMRE" // These bits are the standard items I want my adminsto spawn with
  	};
  };

 

Step 5: Re-PBO everything, copy over the files back into position (mission file and server config file) and the start your server. Kill an Admin and they should respawn with the gear listed instead.

Please note, I took the code from https://github.com/Jenartor/exile_uid-loadout and claim no credit for it. Likewise, I wouldn't have got this working like I wanted without help from @ShootingBlanks, so thank you.

Edited by kuplion
  • Like 1

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.