Fenêtre pour le vendeur de licences
-
<p> Bonjour, il s'agit d'un tutoriel assez simple, cependant il faut avoir un minimum de connaissances pour s'y retrouver !</p>
<p> </p>
<p>Crédit :</p>
<p>-RichHomieQuan pour le tutoriel sur altisliferpg.com</p>
<p>-Moi pour la traduction
</p>
<p> </p>
<p>C'est parti !</p>
<p> </p>
<p>Ajoutez ceci dans le fichier functions.h, en dessous de "shops" :</p>
<pre class="ipsCode prettyprint">
class licenses {};</pre>
<p>Créez un fichier dans le dossier dialog, nommé LicensesDialog.hpp</p>
<pre class="ipsCode prettyprint">
class LicenseShop {
idd = 5546;
name= "life_license_shop";
movingEnable = false;
enableSimulation = true;
onLoad = "uiNamespace setVariable [""LicenseShop"", _this select 0];";
objects[] = { };
class controls {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;
text = "Licenses"; //--- ToDo: Localize;
x = 0.1;
y = 0.2;
w = 0.775;
h = 0.04;
};class Mainbackground : Life_RscText
{
colorBackground[] = {0,0,0,0.7};
idc = -1;
x = 0.1;
y = 0.244;
w = 0.775;
h = 0.52;
};
class listbox: Life_RscListBox
{
idc = 55126;
sizeEx = 0.035;
x = 0.1125;
y = 0.3;
w = 0.3125;
h = 0.4;
};
class ShowLicenseslistbox: Life_RscListBox
{
idc = 55131;
x = 0.55;
y = 0.3;
w = 0.3125;
h = 0.4;
};
class MyLicenses : Life_RscText
{
idc = 55130;
text = "Available "; //--- ToDo: Localize;
x = 0.1875;
y = 0.24;
w = 0.1375;
h = 0.04;
};
class ShowLicenses : Life_RscText
{
idc = 55129;
text = "My Licenses"; //--- ToDo: Localize;
x = 0.65;
y = 0.24;
w = 0.1375;
h = 0.04;
};
class buybutton: Life_RscButtonMenu
{
idc = 55127;
text = "$STR_Global_Buy";
x = 0.4125;
y = 0.72;
w = 0.15;
h = 0.04;
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0.8};
action = "if( (lbData[55126,lbCurSel (55126)] != """") ) then { [false, false, false, lbData[55126,lbCurSel (55126)]] call life_fnc_buyLicense; closeDialog 0; };";
};
};
};
</pre>
<div>Créez un fichier nommé fn_licenses.sqf dans core/shops :</div>
<div>
<pre class="ipsCode prettyprint">
private["_display","_listbox","_shortname","_longname","_price","_hasLicense","_displayname"];_buyables = _this select 3; //called from action => select 3rd argument
if(!dialog) then
{
if(!(createDialog "LicenseShop")) exitWith {};
};
disableSerialization;_display = findDisplay 5546;
if(isNull _display) exitWith {};
_listbox = _display displayCtrl 55126;
_mylic = _display displayCtrl 55131;
_struct = "";{
_shortname = _x;_longname = ([_shortname, 0] call life_fnc_licenseType) select 0;
_displayname = ([_shortname, 0] call life_fnc_licenseType) select 1;
_price = [_shortname] call life_fnc_licensePrice;
_hasLicense = missionNamespace getVariable _longname;if(!_hasLicense) then
{
_listbox lbAdd format["%1 ($%2)", _displayname, _price];
_listbox lbSetData [(lbSize _listbox) - 1, _shortname];
}
else
{
_mylic lbAdd format["%1", _displayname];
_mylic lbSetData [(lbSize _mylic) - 1, _shortname];
};
}
foreach _buyables;
</pre>
<p>Il va falloir aussi changer l'initialisation des pnjs comme ceci (exemple) :</p>
</div>
<pre class="ipsCode prettyprint">
this addAction["Licenses",life_fnc_licenses,["driver","boat","pilot","truck","home","gun"],0,true,true,"",' playerSide == civilian '];
</pre>
<p>Au lieu de :</p>
<pre class="ipsCode prettyprint">
this addAction[format[""%1 ($%2)"",[""license_civ_driver""] call life_fnc_varToStr,[([""driver""] call life_fnc_licensePrice)] call life_fnc_numberText],life_fnc_buyLicense,""driver"",0,false,false,"""",' !license_civ_driver && playerSide == civilian ']; ...
</pre>
<p>Voici un petit screenshot pour la fin :</p>
<p><img alt="43af8e7fe6f0e28f936844c624531f97.png" src="https://i.gyazo.com/43af8e7fe6f0e28f936844c624531f97.png"/></p> -
<p>Tu à sauter une étape</p>
<p> </p>
<p>Il faut aussi ajouter</p>
<pre class="ipsCode prettyprint">
#include "LicensesDialog.hpp"</pre>
<p>Dans /dialog/MasterHandler.h</p>
<p> </p>
<p>Après ça marche parfaitement, merci à toi pour tout les partages que tu fait
</p>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
</p>