Jump to content
Casperento

[RELEASE] Terms And Conditions Menu System

Recommended Posts

Hey guys, today i'm gonna teach you how to install my Terms And Conditions Menu System. It's made for those who want to make player agree with your server's basic rules/conditions.

Difficulty: Medium

Features:
- Fully configurable
- Disconnects player when he don't agree with the terms

-TUTORIAL-

1. Open your Config_Master and add this code inside the Life_settings class:

  cxp_termsAndCond_menuArr[] = { // Messages to be shown on the menu
    "Don't cheat",
    "Join our TS3 if you're a cop/med",
    "Don't spam the game chat",
    "Whatever you WANT HERE"
  };
  cxp_termsAndCond_menuCopMed = false; // Show this menu to the west/independent team ?

2. Open your Functions.hpp file and add these lines as the example:

    class Dialog_Controls {
        file = "dialog\function";
        class bankDeposit {};
        class bankTransfer {};
        class bankWithdraw {};
        class displayHandler {};
        class gangDeposit {};
        class gangWithdraw {};
        class garageLBChange {};
        class impoundMenu {};
        class progressBar {};
        class safeFix {};
        class safeInventory {};
        class safeOpen {};
        class safeTake {};
        class sellGarage {};
        class setMapPosition {};
        class spawnConfirm {};
        class spawnMenu {};
        class spawnPointCfg {};
        class spawnPointSelected {};
        class unimpound {};
        class vehicleGarage {};
        class wireTransfer {};
        class openCxpMenTerms {}; // First line to add
        class agreeCxpMenTerms {}; // Second line to add
        class dAgreeCxpMenTerms {}; // Third line to add
    };

3. Open your description.ext file and add the followed lines into your CfgDebriefing class:
 

class CfgDebriefing {
    class NotWhitelisted {
        title = "$STR_NotWhitelisted_Title";
        subtitle = "$STR_NotWhitelisted_SubTitle";
        description = "$STR_NotWhitelisted_Descript";
        pictureBackground = "";
        picture = "";
        pictureColor[] = {0,0.3,0.6,1};
    };

    class Blacklisted {
        title = "$STR_Blacklisted_Title";
        subtitle = "$STR_Blacklisted_SubTitle";
        description = "$STR_Blacklisted_Descript";
        pictureBackground = "";
        picture = "";
        pictureColor[] = {0,0.3,0.6,1};
    };

    class SpyGlass {
        title = "$STR_SpyDetect_Title";
        subTitle = "$STR_SpyDetect_SubTitle";
        description = "$STR_SpyDetect_Descript";
        pictureBackground = "";
        picture = "";
        pictureColor[] = {0,0.3,0.6,1};
    };
	// !!! THIS ONE !!!!
    class dAgreeCxp {
        title = "SERVER'S NAME";
        subtitle = "If you don't agree, just go away..";
        description = "If this is a mistake, just login to the server again and click the button 'Agree'!";
        pictureBackground = "";
        picture = "";
        pictureColor[] = {0,0.3,0.6,1};
    };
};

4. Open your stringtable.xml file and add the package as the example:
 

<?xml version="1.0" encoding="utf-8"?>
<Project name="Altis Life RPG">
	<!-- 
		YES, BEFORE YOUR 'Init' PACKAGE
		I REALLY DON'T CARE ABOUT THE POSITION OF THIS ONE
	-->
	<Package name="Cxp_MenuTerms">
        <Key ID="STR_Men_Ent_Titulo">
            <Original>SERVER'S NAME</Original>
        </Key>
        <Key ID="STR_Men_Ent_SubTitulo">
            <Original>By playing on our server you agree with the following terms and conditions:</Original>
        </Key>
        <Key ID="STR_Men_Ent_BtnConcord">
            <Original>Agree</Original>
        </Key>
        <Key ID="STR_Men_Ent_BtnDiscord">
            <Original>Disagree</Original>
        </Key>
	</Package>

    <Package name="Init">
        <Key ID="STR_Init_ClientSetup">

5. Open your core\fn_initCiv.sqf, fn_initCop.sqf and  fn_initMedic.sqf files and add the followed lines as the example:
 

// 							INIT MEDIC

#include "..\script_macros.hpp"
/*
    File: fn_initMedic.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Initializes the medic..
*/
waitUntil {!(isNull (findDisplay 46))};

if ((FETCH_CONST(life_medicLevel)) < 1 && (FETCH_CONST(life_adminlevel) isEqualTo 0)) exitWith {
    ["Notwhitelisted",false,true] call BIS_fnc_endMission;
    sleep 35;
};

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Add this verification here
if (LIFE_SETTINGS(getNumber,"cxp_termsAndCond_menuCopMed") isEqualTo 1) then {[] spawn life_fnc_openCxpMenTerms;}else{life_concordDiscord=true;};
waitUntil {life_concordDiscord && isNull (findDisplay 66669)};

[] call life_fnc_spawnMenu;
waitUntil{!isNull (findDisplay 38500)}; //Wait for the spawn selection to be open.
waitUntil{isNull (findDisplay 38500)}; //Wait for the spawn selection to be done.

// 							INIT COP


#include "..\script_macros.hpp"
/*
    File: fn_initCop.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Cop Initialization file.
*/
waitUntil {!(isNull (findDisplay 46))};

if (life_blacklisted) exitWith {
    ["Blacklisted",false,true] call BIS_fnc_endMission;
    sleep 30;
};

if (!(str(player) in ["cop_1","cop_2","cop_3","cop_4"])) then {
    if ((FETCH_CONST(life_coplevel) isEqualTo 0) && (FETCH_CONST(life_adminlevel) isEqualTo 0)) then {
        ["NotWhitelisted",false,true] call BIS_fnc_endMission;
        sleep 35;
    };
};

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Add this verification here
if (LIFE_SETTINGS(getNumber,"cxp_termsAndCond_menuCopMed") isEqualTo 1) then {[] spawn life_fnc_openCxpMenTerms;}else{life_concordDiscord=true;};
waitUntil {life_concordDiscord && isNull (findDisplay 66669)};

player setVariable ["rank",(FETCH_CONST(life_coplevel)),true];
[] call life_fnc_spawnMenu;
waitUntil{!isNull (findDisplay 38500)}; //Wait for the spawn selection to be open.
waitUntil{isNull (findDisplay 38500)}; //Wait for the spawn selection to be done.


// 							INIT CIV

#include "..\script_macros.hpp"
/*
    File: fn_initCiv.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Initializes the civilian.
*/
private _altisArray = ["Land_i_Shop_01_V1_F","Land_i_Shop_01_V2_F","Land_i_Shop_01_V3_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F"];
private _tanoaArray = ["Land_House_Small_01_F"];
private _spawnBuildings = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call TON_fnc_terrainSort;

civ_spawn_1 = nearestObjects[getMarkerPos  "civ_spawn_1", _spawnBuildings,350];
civ_spawn_2 = nearestObjects[getMarkerPos  "civ_spawn_2", _spawnBuildings,350];
civ_spawn_3 = nearestObjects[getMarkerPos  "civ_spawn_3", _spawnBuildings,350];
civ_spawn_4 = nearestObjects[getMarkerPos  "civ_spawn_4", _spawnBuildings,350];

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Add this 2 lines here
[] spawn life_fnc_openCxpMenTerms;
waitUntil {life_concordDiscord && isNull (findDisplay 66669)};

waitUntil {!(isNull (findDisplay 46))};
if (life_is_alive && !life_is_arrested) then {
    /* Spawn at our last position */
    player setVehiclePosition [life_civ_position, [], 0, "CAN_COLLIDE"];
} else {
    if (!life_is_alive && !life_is_arrested) then {
        if (LIFE_SETTINGS(getNumber,"save_civilian_positionStrict") isEqualTo 1) then {
            _handle = [] spawn life_fnc_civLoadout;
            waitUntil {scriptDone _handle};
            CASH = 0;
            [0] call SOCK_fnc_updatePartial;
        };
        [] call life_fnc_spawnMenu;
        waitUntil{!isNull (findDisplay 38500)}; //Wait for the spawn selection to be open.
        waitUntil{isNull (findDisplay 38500)}; //Wait for the spawn selection to be done.
    } else {
        if (life_is_arrested) then {
            life_is_arrested = false;
            [player,true] spawn life_fnc_jail;
        };
    };
};
life_is_alive = true;

6. Open your core\configuration.sqf file and add the followed line as the example:

#include "..\script_macros.hpp"
/*
    File: configuration.sqf
    Author:

    Description:
    Master Life Configuration File
    This file is to setup variables for the client, there are still other configuration files in the system

*****************************
****** Backend Variables *****
*****************************
*/
life_query_time = time;
life_action_delay = time;
life_trunk_vehicle = objNull;
life_session_completed = false;
life_garage_store = false;
life_session_tries = 0;
life_net_dropped = false;
life_siren_active = false;
life_clothing_filter = 0;
life_clothing_uniform = -1;
life_redgull_effect = time;
life_is_processing = false;
life_bail_paid = false;
life_impound_inuse = false;
life_action_inUse = false;
life_spikestrip = objNull;
life_knockout = false;
life_interrupted = false;
life_respawned = false;
life_removeWanted = false;
life_action_gathering = false;
tawvd_addon_disable = true;
life_god = false;
life_frozen = false;
life_save_gear = [];
life_container_activeObj = objNull;
life_disable_getIn = false;
life_disable_getOut = false;
life_admin_debug = false;
life_civ_position = [];
life_markers = false;
life_markers_active = false;
life_canpay_bail = true;
life_storagePlacing = scriptNull;
life_concordDiscord = false; // Add this line here

 

7. Open your dialog\MasterHandler.hpp file and add the followed line as the example:
 

/*
    Master UI Resource File
*/
#include "common.hpp"
#include "shop_items.hpp"
#include "player_inv.hpp"
#include "gang.hpp"
#include "key_chain.hpp"
#include "impound.hpp"
#include "bank.hpp"
#include "veh_shop.hpp"
#include "shops.hpp"
#include "hud_stats.hpp"
#include "admin_menu.hpp"
#include "cell_phone.hpp"
#include "wanted_list.hpp"
#include "ticket.hpp"
#include "clothing.hpp"
#include "trunk.hpp"
#include "spawnSelection.hpp"
#include "chop_shop.hpp"
#include "pInteraction.hpp"
#include "deathScreen.hpp"
#include "vehicleShop.hpp"
#include "vehicleShop3D.hpp"
#include "settings.hpp"
#include "federalReserve.hpp"
#include "compensate.hpp"
#include "FuelStat.hpp"
#include "newsStation.hpp"
#include "cxp_terms_menu.hpp" // Add this include HERE!!

8. Copy and paste the attached files into your dialog\ and dialog\functions folders and you're ready!!

*dialog\cxp_terms_menu.hpp
*dialog\function\fn_openCxpMenTerms.sqf
*dialog\function\fn_agreeCxpMenTerms.sqf
*dialog\function\fn_dAgreeCxpMenTerms.sqf

RESULT:

https://imgur.com/Zvavji5

!-DOWNLOAD-!

cxp_terms_menu.hpp

fn_agreeCxpMenTerms.sqf

fn_dAgreeCxpMenTerms.sqf

fn_openCxpMenTerms.sqf

Edited by Casperento
Important fix
  • Like 3
  • Thanks 1

Share this post


Link to post
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.


×
×
  • Create New...

Important Information

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