Jump to content

Notification System 4.0 | 5.0


Stalker
 Share

Recommended Posts


Notification System

Before we start Notification System has been tested on latest release for AsYetUntitled. (2021-05-17)


Original Credits: https://native-network.net/forum/thread/3924-tutorial-de100-benachrichtigungssystem/
Edit Credit: Stalker


Tutorial

Step 1: Open file ( >> RootMission>> config >> Config_Master.hpp) Add Under framework_version Add

 

 class notification {
        // Server Name
        serverName = "Your Server Name";
    };

Example
 

   /* ! --- Do not change --- ! */
    framework_version = "5.0.0";
    /* ------------------------- */

        class notification {
        // Server Name
        serverName = "Altis";
    };



 Step 2: Open File ( >> RootMission >> Functions.hpp) Go to Master_Directory Add Under welcomeNotification


 

class notificationSystem {};


Example
 

class Life_Client_Core {
    tag = "life";

    class Master_Directory {
        file = "core";
        class initCiv {};
        class initCop {};
        class initMedic {};
        class setupActions {};
        class setupEVH {};
        class survival {};
        class welcomeNotification {};
        class notificationSystem {};
    };



 Step 3: Go to ( >> RootMission >> Core )  Create a new file named: (fn_notificationSystem.sqf 


Step 4: Open fn_notificationSystem.sqf Paste the Below Code inside SQF File

/*
    File:    fn_notificationSystem.sqf
    Date Relase:   2016-07-23 18:15:17
    Last Edit:   2021-05-17
    Author: Patrick "Lucian" Schmidt
    Original Credits: https://native-network.net/forum/thread/3924-tutorial-de100-benachrichtigungssystem/
    Edited By: Stalker
*/


params[
	"_text",
	["_customnotification", "true", ["",[],{}]],
	["_speed","",[""]]
];

if (!hasInterface) exitWith {};




disableSerialization;
_display = finddisplay 46;

_color = "";
private _headerIcon = "";
private _headerIconSize = 0.85;

switch (_customnotification) do
{
    case "Information": {
        _color = [0.129,0.588,0.953,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa"; _headerIconSize = 0.85;
    };

    case "event": {
        _color = [0.337,0.031,0.514,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\default_ca.paa"; _headerIconSize = 0.85;
    };

    case "error": {
        _color = [1,0,0,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\danger_ca.paa"; _headerIconSize = 0.85;
    };

    case "warning": {
        _color = [0.722,0.349,0,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\destroy_ca.paa"; _headerIconSize = 0.85;
    };

    case "admin": {
        _color = [0,1,0.831,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\interact_ca.paa"; _headerIconSize = 0.85;
    };

    case "true": {
        _color = [0.298,0.686,0.314,1];
        _headerIcon = "\a3\ui_f\data\igui\cfg\simpletasks\types\help_ca.paa"; _headerIconSize = 0.7;
    };
};

playSound "HintExpand";


if (_text isEqualType "") then {
	_text = parseText _text;
};

private _Header = _display ctrlCreate ["RscStructuredText", -1];
_Header ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.151 * safezoneH + safezoneY, 0.2 * safezoneW, 0.02 * safezoneH];
_Header ctrlSetBackgroundColor _color;
_Header ctrlSetFade 1;
_Header ctrlCommit 0;
_Header ctrlSetFade 0;
_Header ctrlCommit 0.4;
_Header ctrlSetStructuredText parseText format["<img align='left' size='%3' image='%1'/><t size='0.85' align='right' font='PuristaSemiBold'>%2</t>",_headerIcon,getText(missionConfigFile >> "Life_Settings" >> "notification" >> "serverName"),_headerIconSize];

private _TextField = _display ctrlCreate ["RscStructuredText", -1];

_TextField ctrlSetStructuredText parseText format["<t size='0.85' align='left' font='PuristaMedium'>%1</t>",_text];
_TextField ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.171 * safezoneH + safezoneY,0.2 * safezoneW, 0.5];
_TextField ctrlCommit 0;
_TextField ctrlSetPosition [0.795 * safezoneW + safezoneX, 0.171 * safezoneH + safezoneY,0.2 * safezoneW, ((ctrlTextHeight _TextField)+ (0.005 * safezoneH))];
_TextField ctrlSetBackgroundColor [0,0,0,0.75];
_TextField ctrlSetFade 1;
_TextField ctrlCommit 0;
_TextField ctrlSetFade 0;
_TextField ctrlCommit 0.4;

[_TextField,_Header,_speed] spawn {
	disableSerialization;
	if (_this select 2 isEqualTo "fast") then {
		uiSleep 8;
	} else {
		uiSleep 15;
	};

	private _TextField = _this select 0;
	private _Header = _this select 1;
	_TextField ctrlSetFade 1;
	_TextField ctrlCommit 0.3;
	_Header ctrlSetFade 1;
	_Header ctrlCommit 0.3;
	uiSleep 0.3;
	ctrlDelete _Header;
	ctrlDelete _TextField;
};

private _posText = (ctrlPosition (_TextField)) select 1;
private _posHeader = (ctrlPosition (_Header)) select 1;
private _textHigh = (ctrlPosition (_TextField)) select 3;
if(isNil{life_open_notifications}) then {life_open_notifications = [];};
if (count life_open_notifications > 0) then {
	private _activeNotifications = 0;
	{
		private _ctrlHeader = _x select 0;
		private _ctrlText = _x select 1;
		if (!isNull _ctrlHeader && !isNull _ctrlText) then {
			_ctrlHeader ctrlSetPosition [0.795 * safezoneW + safezoneX, (_posHeader + _textHigh + 2*(0.011 * safezoneH))];
			_ctrlText ctrlSetPosition [0.795 * safezoneW + safezoneX, (_posText + _textHigh + 2*(0.011 * safezoneH))];
			_ctrlHeader ctrlCommit 0.25;
			_ctrlText ctrlCommit 0.25;
			_posText = (_posText + _textHigh + 2*(0.011 * safezoneH));
			_posHeader = (_posHeader + _textHigh + 2*(0.011 * safezoneH));
			_textHigh = (ctrlPosition (_ctrlText)) select 3;
			if (_activeNotifications > 3) then {
				_ctrlText ctrlSetFade 1;
				_ctrlHeader ctrlSetFade 1;
				_ctrlText ctrlCommit 0.2;
				_ctrlHeader ctrlCommit 0.2;
			};
			_activeNotifications = _activeNotifications + 1;
		};
	} forEach life_open_notifications;
};

life_open_notifications = ([[_Header,_TextField]] + life_open_notifications) select {!isNull (_x select 0) && !isNull (_x select 1)};	



Example Code:
 

["Dont break Server Rules", "Information"] call life_fnc_notificationSystem; //Information Message

["You cant do that inside Vehicle", "error"] call life_fnc_notificationSystem; //Error Message

["Event will be start after 10m", "event"] call life_fnc_notificationSystem;  //Events Message

["ADMIN MSG: Restart After 10m", "admin"] call life_fnc_notificationSystem;  //Admin Message

["The Kavala Bank Has being Robbed", "warning"] call life_fnc_notificationSystem;  //warning Message

["You got $5000 From Bank Robbery", "true"] call life_fnc_notificationSystem;  //successfully Message 


fe9a3e3e518d53afa19a283a22fe47ac.png

Edited by Stalker
  • Like 4
Link to comment
Share on other sites

  • Stalker changed the title to Notification System 4.0 | 5.0
  • 1 month later...
  • 1 year later...
On 7/6/2021 at 1:38 AM, Rudy1337 said:

I'm noob in this how i can setup this notifications to everywhere? ( for example in atm ) 

Change the example
before change
   if ((lbCurSel 3101) isEqualTo -1) exitWith {titleText[localize “STR_Shop_NoClothes”,“PLAIN”];};
after change if ((lbCurSel 3101) isEqualTo -1) exitWith {[“123321414”,“
error”] call life_fnc_notificationSystem;};

Edited by NIGO
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.