English License withdrawal by the Police

  • Auteur de la discussion Auteur de la discussion I'm the Boss
  • Date de début Date de début

I'm the Boss

Admin
2/1/20
657
3
43
1 100
This tutorial will allow you to add a function to remove a license to a player as a police officer.​

Installation :
  • Go to the root of your mission and then in the dialog folder
  • Create a file named revoke_license.hpp in the dialog folder
  • Copy / Paste the code below into your revoke_license.hpp :
Code:
Développer Réduire Copier
#define BGX 0.35
#define BGY 0.2
#define BGW 0.3

class revokeLicense_Menu
{
    idd = 41000;
    movingEnable = 0;
    enableSimulation = 1;

    class controlsBackground {
        class RscTitleBackground:life_RscText
        {
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
            idc = -1;
            x = BGX;
            y = BGY;
            w = BGW;
            h = (1 / 25);
        };

        class MainBackground : life_RscText
        {
            idc = -1;
            colorBackground[] = {0,0,0,0.7};
            x = BGX;
            y = BGY + (11 / 250);
            w = BGW;
            h = 0.6 - (22 / 250);
        };

        class Title : life_RscTitle
        {
            colorBackground[] = {0,0,0,0};
            idc = 41001;
            text = "Retrait Licences";
            x = BGX;
            y = BGY;
            w = BGW;
            h = (1 / 25);
        };
    };

    class controls {

        class ButtonClose : life_RscButtonMenu
        {
            idc = -1;
            text = "Fermer";
            onButtonClick = "closeDialog 0;";
            x = BGX;
            y = 0.8 - (1 / 25);
            w = (6.25 / 40);
            h = (1 / 25);
        };

        class ButtonOne : life_RscButtonMenu
        {
            idc = 41002;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Permis VL";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.07;
            w = 0.24;
            h = 0.038;
        };

        class ButtonTwo : life_RscButtonMenu
        {
            idc = 41003;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Permis PL";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.12;
            w = 0.24;
            h = 0.038;
        };

        class ButtonThree : life_RscButtonMenu
        {
            idc = 41004;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Permis Moto";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.17;
            w = 0.24;
            h = 0.038;
        };

        class ButtonFour : life_RscButtonMenu
        {
            idc = 41005;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Brevet de Pilote";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.22;
            w = 0.24;
            h = 0.038;
        };

        class ButtonFive : life_RscButtonMenu
        {
            idc = 41006;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Permis Bateau";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.27;
            w = 0.24;
            h = 0.038;
        };

        class ButtonSix : life_RscButtonMenu
        {
            idc = 41007;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "Port d'Armes";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.32;
            w = 0.24;
            h = 0.038;
        };

        class ButtonSeven : life_RscButtonMenu
        {
            idc = 41008;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.37;
            w = 0.24;
            h = 0.038;
        };

        class ButtonEight : life_RscButtonMenu
        {
            idc = 41009;
            colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
            text = "";
            sizeEx = 0.025;
            x = BGX + 0.03;
            y = BGY + 0.42;
            w = 0.24;
            h = 0.038;
        };
    };
};
  • Sauvegardez le fichier
  • Ouvrez le fichier dialog\MasterHandler.hpp
  • Ajoutez à la fin du fichier :
Code:
Développer Réduire Copier
#include "revoke_license.hpp"
  • Now go to the core \ pmenu folder
  • Create a file named fn_revokeLicense.sqf
  • Then copy / paste the code below inside the file :
Code:
Développer Réduire Copier
/*
    File: fn_revokeLicense.sqf
    Author: Michael Francis

    Description:
    Allows cops to revoke individual licenses, or all licenses. Vehicle related only.
*/
private["_display","_curTarget","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];


params [
    ["_curTarget",objNull,[objNull]]
];
disableSerialization;
if (!(createDialog "revokeLicense_Menu")) exitWith {hint "revokeLicense_Menu Fail"};
if(isNull _curTarget) exitWith {hint "Wrong target!"; closeDialog 0;}; //Bad target
if(!isPlayer _curTarget && side _curTarget == civilian) exitWith {hint "Cannot perform this action!"; closeDialog 0;}; //Bad side check?

_display = findDisplay 41000;
_Btn1 = _display displayCtrl 41002;
_Btn2 = _display displayCtrl 41003;
_Btn3 = _display displayCtrl 41004;
_Btn4 = _display displayCtrl 41005;
_Btn5 = _display DisplayCtrl 41006;
_Btn6 = _display DisplayCtrl 41007;
_Btn7 = _display DisplayCtrl 41008;
_Btn8 = _display DisplayCtrl 41009;
life_pInact_curTarget = _curTarget;

_Btn1 buttonSetAction "[4] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn2 buttonSetAction "[5] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn3 buttonSetAction "[6] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn4 buttonSetAction "[7] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn5 buttonSetAction "[8] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn6 buttonSetAction "[9] remoteExecCall [""life_fnc_removeLicenses"",life_pInact_curTarget]; closeDialog 0;";
_Btn7 ctrlShow false;
_Btn8 ctrlShow false;
  • Save the file
  • Open the Functions.hpp file located at the root of your mission
  • Add in Class Player_Menu
Code:
Développer Réduire Copier
class revokeLicense {};
  • Like that :
Code:
Développer Réduire Copier
    class Player_Menu {
        file = "core\pmenu";
        class cellphone {};
        class giveItem {};
        class giveMoney {};
        class keyDrop {};
        class keyGive {};
        class keyMenu {};
        class p_openMenu {};
        class p_updateMenu {};
        class removeItem {};
        class s_onChar {};
        class s_onCheckedChange {};
        class s_onSliderChange {};
        class settingsMenu {};
        class updateViewDistance {};
        class useItem {};
        class revokeLicense {};  // <----------- Revoke Licenses     
    };
  • Now go to fn_removeLicenses.sqf located in core \ civilian
  • If the file is original add after :
Code:
Développer Réduire Copier
case 3: {
   ....
};
  • The code below :
Code:
Développer Réduire Copier
// Retrait Licences
    case 4: {
        missionNamespace setVariable [LICENSE_VARNAME("driver","civ"), false];
        hint "Your driver's license has been revoked by the Police !";
    };

    case 5: {
        missionNamespace setVariable [LICENSE_VARNAME("trucking","civ"), false];
        hint "Your truck licence has been revoked by the Police !";
    };

    case 6: {
        missionNamespace setVariable [LICENSE_VARNAME("bike","civ"), false];
        hint "Your Moto A2 licence has been revoked by the Police !";
    };

    case 7: {
        missionNamespace setVariable [LICENSE_VARNAME("pilot","civ"), false];
        hint "Your pilot's license has been revoked by the Police !";
    };

    case 8: {
        missionNamespace setVariable [LICENSE_VARNAME("boat","civ"), false];
        hint "Votre permis bateau vous à été retiré par la Police !";
    };

    case 9: {
        missionNamespace setVariable [LICENSE_VARNAME("gun","civ"), false];
        hint "Your licence to carry weapons has been revoked by the Police !";
    };
(If the file already has the numbers box 4 to 9, simply change the values and transfer them to fn_revokeLicense.sqf)
  • Now open your fn_copInteractionMenu.sqf located in core \ cop
  • And add the next button all the way down :
Code:
Développer Réduire Copier
// Revoke Licenses
_Btn9 ctrlSetText localize "STR_pInAct_RevokeLicense";
_Btn9 buttonSetAction "[life_pInact_curTarget] call life_fnc_revokeLicense;";
(If you have never created the _ Btn9 in your pInterraction_Menu.hpp located in the folder dialog I invite you to follow the tutorial EN | Add a button in the pInteraction_Menu / vInteraction_Menu on the forum)

That's it, you just added the menu to withdraw licenses to the Policeman 😋
 
Dernière édition par un modérateur:
  • Like
Les réactions: IceEagle132
Activité
Pour l'instant, il n'y a personne ici