Jump to content
  • 0

Force players to log out on skin change?


Rocu

Question

So I'm trying to semi-disable (if that's a word) the skin changing process. I want to force players to re-log back into the game to change their skins. By force I don't mean that players actually get disconnected by the game but instead a message that pops up saying 'In order to change your skin you must re-log'. After looking into files like player_switchModel.sqf, player_humanityMorph.sqf, player_wearClothes.sqf I managed to go as far as disabling the model-changing and getting the message to pop up. But I can't seem to actually apply the skin change to their character in my database. Their clothing item disappears and Civilian clothes appears but if they re-log they still have their civilian clothing on.

 

I didn't see a code that would actually update the player's model on the database so I'm assuming it doesn't actually do that? It just relies on player_sync to update their current model.

Unless I'm completely wrong and I missed something.

 

Anyway, if anyone knows a workaround that can lead to that, that'd be great.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

yes, player sync does that. You could edit the sync to use a Global Variable to update the player_model ( then set this global variablre in your switch_model for example). So it gets updated, but u dont see it until he relogs.

Link to comment
Share on other sites

  • 0

in player_wearClothes.sqf

add this
 

if (!isNil "SkinChangeOnce") exitWith 
DZE_ActionInProgress = false;
	cutText ['You have already changed your skin, please log to lobby and back to change your skin again!', 'PLAIN'];
};

after 


call gear_ui_init;
closeDialog 1;

Add this 

SkinChangeOnce = true;

right before 

DZE_ActionInProgress = false; 

at the bottom 
 
 
CREDIT: MACA134

Link to comment
Share on other sites

  • 0

Ahh, I had that problem once, but was another script that caused it (Can't remember which)

 

But even with out this script I can change skin all that I wan't, change skin over 20 times with in 5 min when I tested my overpoch skin, no ploblems.

 

I only added this script to make it easyer to track skin change dupe

Link to comment
Share on other sites

  • 0

after 

call gear_ui_init;
closeDialog 1;

 

 

Just now I tried to implement this and it doesn't seem to work. Firstly I dont have 'closeDialog 1;' line in my player_wearClothes.sqf. Nevertheless I tried those said things and it didn't work. I click 'Wear clothes' on an item and nothing happens. I click it again and a message pops up 'Changing clothes already in progess.'

 

Here's my player_wearClothes.sqf WITH the update applied:

 

/*
_item spawn player_wearClothes;
Added Female skin changes - DayZ Epoch - vbawol
*/
private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_itemNew","_currentSex","_newSex","_model","_playerNear"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_83") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

_item = _this;
call gear_ui_init;

if (!isNil "SkinChangeOnce") exitWith 
DZE_ActionInProgress = false;
	cutText ['Please log to lobby and back to change your skin!', 'PLAIN'];
};

_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};

_hasclothesitem = _this in magazines player;
_config = configFile >> "CfgMagazines";
_text = getText (_config >> _item >> "displayName");

if (!_hasclothesitem) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};

if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};

//if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_9"), "PLAIN DOWN"] };

if ("CSGAS" in (magazines player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_10"), "PLAIN DOWN"] };

_myModel = (typeOf player);
_itemNew = "Skin_" + _myModel;

//diag_log ("Debug Clothes: model In: " + str(_itemNew) + " Out: " + str(_item));

if ( (isClass(_config >> _itemNew)) ) then {
	if ( (isClass(_config >> _item)) ) then {
		// Current sex of player skin
		
		_currentSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _itemNew >> "sex");
		// Sex of new skin
		_newSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "sex");
		//diag_log ("Debug Clothes: sex In: " + str(_currentSex) + " Out: " + str(_newSex));

		if(_currentSex == _newSex) then {
			// Get model name from config
			_model = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "playerModel");
			if (_model != _myModel) then {
				if(([player,_item] call BIS_fnc_invRemove) == 1) then {
					player addMagazine _itemNew;
					[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
				};
			};

		} else {
			cutText [(localize "str_epoch_player_86"), "PLAIN DOWN"];
		};
	};
};
SkinChangeOnce = true;
DZE_ActionInProgress = false;
 

 

 

Edit// Okay there was a missing '{' from your code I added it but it still doesn't do the trick.

 

I get it that it blocks you from changing clothes twice but that's not really my issue here. I want it to apply changes only in database not in-game so that you need to re log for the skin to apply.

 

 

 

Edit2// Nvm solution found below, mods can delete this post

Edited by Rocu
Link to comment
Share on other sites

  • 0

Bump? Still looking a solution for this. 

I've managed to get as far as everything working as it should except the skin doesn't update in database when player re logs.

 

 

Edit// Solution found below, mods can delete this post

Link to comment
Share on other sites

  • 0

(Sorreh for triple post)

 

yes, player sync does that. You could edit the sync to use a Global Variable to update the player_model ( then set this global variablre in your switch_model for example). So it gets updated, but u dont see it until he relogs.

 

Couldn't find a decent script anywhere so I took your advice and did it myself. Thanks for the tip. It works perfectly.

If anyone wants this script let me know.

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...