Ce tutoriel vous permettra d'ajouter une fonction permettant retirer une licence à un joueur en tant que policier.
Installation :
- Rendez-vous à la racine de votre mission puis dans le dossier dialog
- Créer un fichier nommé revoke_license.hpp dans le dossier dialog
- Copier/Coller le code ci-dessous dans votre revoke_license.hpp :
Code:
#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:
#include "revoke_license.hpp"
- Maintenant, allez dans le dossier core\pmenu
- Créer un fichier nommé fn_revokeLicense.sqf
- Puis Copier/Coller le code ci-dessous à l'intérieur du fichier :
Code:
/*
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;
- Sauvegardez le fichier
- Ouvrez le fichier Functions.hpp situé à la racine de votre mission
- Ajoutez dans Class Player_Menu
Code:
class revokeLicense {};
Code:
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
};
- Maintenant, rendez-vous dans le fichier fn_removeLicenses.sqf situé dans core\civilian
- Si le fichier est d'origine ajoutez après :
Code:
case 3: {
....
};
Code:
// Retrait Licences
case 4: {
missionNamespace setVariable [LICENSE_VARNAME("driver","civ"), false];
hint "Votre permis de conduire vous à été retiré par la Police !";
};
case 5: {
missionNamespace setVariable [LICENSE_VARNAME("trucking","civ"), false];
hint "Votre permis Poids-Lourd vous à été retiré par la Police !";
};
case 6: {
missionNamespace setVariable [LICENSE_VARNAME("bike","civ"), false];
hint "Votre permis Moto A2 vous à été retiré par la Police !";
};
case 7: {
missionNamespace setVariable [LICENSE_VARNAME("pilot","civ"), false];
hint "Votre brevet de pilote vous à été retiré par la 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 "Votre permis port-d'armes vous à été retiré par la Police !";
};
- Maintenant, ouvrez votre fn_copInteractionMenu.sqf situé dans core\cop
- Et ajoutez le bouton suivant tout en bas :
Code:
// Revoke Licenses
_Btn9 ctrlSetText "Retirer licences";
_Btn9 buttonSetAction "[life_pInact_curTarget] call life_fnc_revokeLicense;";
Voilà, vous venez d'ajouter le menu pour retirer des licences au Policier
Dernière édition par un modérateur: