Jump to content
  • 0

looter809

Question

So I have heard and seen that you can save settings to a character. For example, a player changes his view distance and after logging back in it will keep that setting he has changed.

The way I want to use this: I have some music that plays when a player loads into the server, and I am trying to allow them an option to turn it off permanently if they decide to. I heard something about profileNamespace is what I need to do, but I do not know how to do this. I just need some basic information on how to do such a thing, I can figure out how to make the option for the player via right click option or scroll wheel option, but I am confused on most of the other stuff.

In my rules.sqf,

private ["_messages","_timeout"];

waitUntil {uiSleep 1; !isNil ("Dayz_loginCompleted")};
playSound "introSong";
systemChat "Welcome!";

_messages = [
	["DayZ Epoch", "Welcome "+(name player)],
	["World", worldName],
	["Teamspeak", "myTeamspeak"],
	["Website/Forums", "myWebsite"],
	["Server Rules", "myRules"],
	["News", "myNews"]
];
  
_timeout = 5;
{
	private ["_title","_content","_titleText"];
	uiSleep 2;
	_title = _x select 0;
	_content = _x select 1;
	_titleText = format[("<t font='TahomaB' size='0.40' color='#a81e13' align='right' shadow='1' shadowColor='#000000'>%1</t><br /><t shadow='1'shadowColor='#000000' font='TahomaB' size='0.60' color='#FFFFFF' align='right'>%2</t>"), _title, _content];
	[
		_titleText,
		[safezoneX + safezoneW - 0.8,0.50],     //DEFAULT: 0.5,0.35
		[safezoneY + safezoneH - 0.8,0.7],      //DEFAULT: 0.8,0.7
		_timeout,
		0.5
	] spawn BIS_fnc_dynamicText;
	uiSleep (_timeout * 1.1);
} forEach _messages;

and I know I would do something like

_loadMusic = ???
if (_loadMusic) then {
	playSound "introSong";
	systemChat "Welcome!";
};

 

But from there, I don't know much else of what to do. Maybe it's really simple and easy and I just don't see it, or maybe I have to define a variable for the toggle option of the music in a bunch of complicated ways.

 

Does anyone have any knowledge they can share with me? Thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You are correct profile namespace is what you should use,

Here is an example from my 1.0.6 server

Quote

MGG_vd = profileNameSpace getVariable ['MGG_vd',800]; // 800 represents the value that it will default too if the player has not changed it
setViewDistance MGG_vd;
MGG_volume = profileNameSpace getVariable ['MGG_volume',0.5]; // 0.5 ^^^^
0 fadeSound MGG_volume;

Now, to change the variables i use the F6 key which is +100 viewdistance and F5 key which is -100 viewdistance.

and F7/F8 for volume...

Example:

Quote

mgg_changevd = {
       MGG_vd = MGG_vd + _this;
        if (MGG_vd < 100) then { MGG_vd = 100; }; // min 100 view distance
        if (MGG_vd > 5000) then { MGG_vd = 5000; }; // max 5000 view distance
        setViewDistance MGG_vd;
        profileNamespace setVariable ['MGG_vd',MGG_vd]; // Set the variable to be persistent (save on relog)

};

You can also copy and use this function for volume, simply change the variables.

Now to use this function you can simple do "-100 call mgg_changevd;" or "100 call mgg_changevd;"

 

Hope this helps,

for more info on profileNamespace check out the BIS WIKI:

https://community.bistudio.com/wiki/profileNamespace

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

×
×
  • Create New...