Skip to content

Commit

Permalink
05/16/2017
Browse files Browse the repository at this point in the history
  • Loading branch information
Ppgtjmad committed May 16, 2017
1 parent 6ff3b9b commit ef44b0d
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 24 deletions.
17 changes: 12 additions & 5 deletions HG/Functions/Generic/fn_lockOrUnlock.sqf
Expand Up @@ -4,17 +4,24 @@
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
params["_vehicle"];
params["_vehicle","_lock"];

if((locked _vehicle) isEqualTo 2) then
{
_vehicle lock 0;
_lock = 0;
playSound "hg_unlock";
hintSilent (localize "STR_HG_VEHICLE_UNLOCKED")
hintSilent (localize "STR_HG_VEHICLE_UNLOCKED");
} else {
_vehicle lock 2;
_lock = 2;
playSound "hg_lock";
hintSilent (localize "STR_HG_VEHICLE_LOCKED")
hintSilent (localize "STR_HG_VEHICLE_LOCKED");
};

if(local _vehicle) then
{
_vehicle lock _lock;
} else {
[_vehicle,_lock] remoteExecCall ["lock",-2,false];
};

true;
3 changes: 2 additions & 1 deletion HG/Functions/Generic/fn_setOwner.sqf
Expand Up @@ -3,10 +3,11 @@
© All Fucks Reserved
Website - http://www.sunrise-production.com
*/
params["_vehicle","_unit"];
params["_vehicle",["_unit",player,[objNull]]];

_vehicle setVariable["HG_Owner",[(getPlayerUID _unit),round(random(100000))],true];
[_vehicle] call HG_fnc_addActions;

hint format[(localize "STR_HG_NOW_OWNER"),(getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"))];

true;
1 change: 1 addition & 0 deletions HG/Functions/HG_Functions.h
Expand Up @@ -98,6 +98,7 @@ class HG
{
file = "HG\Functions\VehiclesShop";
class addActions {};
class buyToGarage {};
class buyVehicle {};
class dialogOnLoadVehicles {};
class dialogOnUnloadVehicles {};
Expand Down
1 change: 1 addition & 0 deletions HG/Functions/VehiclesShop/HG_Macros.h
Expand Up @@ -10,5 +10,6 @@
#define HG_VEHICLES_SWITCH (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_SWITCH_IDC)
#define HG_VEHICLES_LIST (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_LIST_IDC)
#define HG_VEHICLES_SP (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_SP_IDC)
#define HG_VEHICLES_TG (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_TG_IDC)
#define HG_VEHICLES_BUY (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_BUY_IDC)
#define HG_VEHICLES_MC (HG_VEHICLES_SHOP_DISP displayCtrl HG_VEHICLES_MC_IDC)
23 changes: 23 additions & 0 deletions HG/Functions/VehiclesShop/fn_buyToGarage.sqf
@@ -0,0 +1,23 @@
#include "HG_Macros.h"
/*
Author - HoverGuy
© All Fucks Reserved
Website - http://www.sunrise-production.com
*/

disableSerialization;

private _price = HG_VEHICLES_LIST lbValue (lbCurSel HG_VEHICLES_LIST);

if([_price] call HG_fnc_hasEnoughMoney) then
{
[_price,1] call HG_fnc_addOrSubCash;
closeDialog 0;
private _classname = HG_VEHICLES_LIST lbData (lbCurSel HG_VEHICLES_LIST);
hint format[(localize "STR_HG_VEHICLE_BOUGHT"),(getText(configFile >> "CfgVehicles" >> _classname >> "displayName")),if(_price <= 0) then {(localize "STR_HG_DLG_FREE")} else {([_price,true] call HG_fnc_currencyToText)}];
[player,_classname] remoteExecCall ["HG_fnc_storeVehicleS",2,false];
} else {
titleText [format[(localize "STR_HG_NOT_ENOUGH_MONEY"),([_price,true] call HG_fnc_currencyToText)],"PLAIN DOWN",1];
};

true;
9 changes: 4 additions & 5 deletions HG/Functions/VehiclesShop/fn_buyVehicle.sqf
Expand Up @@ -12,19 +12,18 @@ private _price = HG_VEHICLES_LIST lbValue (lbCurSel HG_VEHICLES_LIST);

if([_price] call HG_fnc_hasEnoughMoney) then
{
private["_shopType","_spawnPoints","_spawnPoint"];
private["_shopType","_spawnPoints","_spawnPoint"];
_shopType = HG_VEHICLES_SWITCH lbData (lbCurSel HG_VEHICLES_SWITCH);
_shopType = _shopType splitString "/";
_spawnPoints = getArray(missionConfigFile >> "CfgClient" >> "HG_VehiclesShopCfg" >> (_shopType select 0) >> (_shopType select 1) >> "spawnPoints");
_spawnPoint = [((_spawnPoints select (HG_VEHICLES_SP lbValue (lbCurSel HG_VEHICLES_SP))) select 1)] call HG_fnc_isItBusy;

if(_spawnPoint != "") then
{
private["_classname","_displayName"];
_classname = HG_VEHICLES_LIST lbData (lbCurSel HG_VEHICLES_LIST);
_displayName = getText(configFile >> "CfgVehicles" >> _classname >> "displayName");
[_price,1] call HG_fnc_addOrSubCash;
closeDialog 0;
hint format[(localize "STR_HG_VEHICLE_BOUGHT"),_displayName,if(_price <= 0) then {(localize "STR_HG_DLG_FREE")} else {([_price,true] call HG_fnc_currencyToText)}];
private _classname = HG_VEHICLES_LIST lbData (lbCurSel HG_VEHICLES_LIST);
hint format[(localize "STR_HG_VEHICLE_BOUGHT"),(getText(configFile >> "CfgVehicles" >> _classname >> "displayName")),if(_price <= 0) then {(localize "STR_HG_DLG_FREE")} else {([_price,true] call HG_fnc_currencyToText)}];
[0,player,_classname,_spawnPoint] remoteExecCall ["HG_fnc_spawnVehicle",2,false];
} else {
titleText [(localize "STR_HG_SPAWN_POINTS_BUSY"),"PLAIN DOWN",1];
Expand Down
43 changes: 34 additions & 9 deletions HG/Setup/fn_serverInitialization.sqf
Expand Up @@ -213,20 +213,40 @@ HG_fnc_deleteVehicle = compileFinal
true;
";

HG_fnc_storeVehicleS = compileFinal
HG_fnc_vehicleSetup =
"
params['_unit','_vehicle','_plate','_garage','_index'];
params['_unit','_classname',['_plate',round(random(100000)),[0]],'_garage'];
_garage = profileNamespace getVariable[format['HG_Garage_%1',(getPlayerUID _unit)],[]];
_index = [_plate,_garage] call HG_fnc_findIndex;
(_garage select _index) set [2,0];
profileNamespace setVariable[format['HG_Garage_%1',(getPlayerUID _unit)],_garage];
_garage pushBack [_classname,_plate,0];
saveProfileNamespace;
if((getNumber(missionConfigFile >> 'CfgClient' >> 'enableVehicleInventorySave')) isEqualTo 1) then
";

HG_fnc_storeVehicleS = compileFinal
"
params['_unit','_vehicle',['_plate',round(random(100000)),[0]],'_garage','_index'];
_garage = profileNamespace getVariable[format['HG_Garage_%1',(getPlayerUID _unit)],[]];
if((typeName _vehicle) isEqualTo 'STRING') then
{
[_vehicle] call HG_fnc_getInventory;
_garage pushBack [_vehicle,_plate,0];
} else {
_index = [_plate,_garage] call HG_fnc_findIndex;
if(_index != -1) then
{
(_garage select _index) set [2,0];
} else {
_garage pushBack [(typeOf _vehicle),_plate,0];
};
if((getNumber(missionConfigFile >> 'CfgClient' >> 'enableVehicleInventorySave')) isEqualTo 1) then
{
[_vehicle] call HG_fnc_getInventory;
};
deleteVehicle _vehicle;
};
deleteVehicle _vehicle;
profileNamespace setVariable[format['HG_Garage_%1',(getPlayerUID _unit)],_garage];
saveProfileNamespace;
(localize 'STR_HG_GRG_VEHICLE_STORED') remoteExecCall ['hint',(owner _unit),false];
true;
Expand All @@ -247,7 +267,12 @@ HG_fnc_disconnect = compileFinal
{
_plate = _owner select 1;
_index = [_plate,_garage] call HG_fnc_findIndex;
(_garage select _index) set [2,0];
if(_index != -1) then
{
(_garage select _index) set [2,0];
} else {
_garage pushBack [(typeOf _x),_plate,0];
};
if(_saveInv) then
{
[_x] call HG_fnc_getInventory;
Expand Down
22 changes: 21 additions & 1 deletion HG/UI/Dialogs/HG_VehiclesShop.h
Expand Up @@ -107,6 +107,15 @@ class HG_VehiclesShop
h = 2 * GUI_GRID_H;
};

class ToGarageBtnPicture: HG_RscPicture
{
text = "HG\UI\Icons\garage.paa";
x = 26 * GUI_GRID_W + GUI_GRID_X;
y = -10 * GUI_GRID_H + GUI_GRID_Y;
w = 3 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
};

class BuyBtnPicture: HG_RscPicture
{
text = "HG\UI\Icons\buy.paa";
Expand Down Expand Up @@ -178,11 +187,22 @@ class HG_VehiclesShop
h = 1 * GUI_GRID_H;
};

class ToGarageButton: HG_RscButtonInvisible
{
idc = HG_VEHICLES_TG_IDC;
tooltip = "$STR_HG_DLG_VS_TG_TOOLTIP";
onButtonClick = "[] call HG_fnc_buyToGarage";
x = 26 * GUI_GRID_W + GUI_GRID_X;
y = -10 * GUI_GRID_H + GUI_GRID_Y;
w = 3 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
};

class BuyButton: HG_RscButtonInvisible
{
idc = HG_VEHICLES_BUY_IDC;
tooltip = "$STR_HG_DLG_VS_BUY_TOOLTIP";
onButtonClick = "_this call HG_fnc_buyVehicle";
onButtonClick = "[] call HG_fnc_buyVehicle";
x = 29.5 * GUI_GRID_W + GUI_GRID_X;
y = -10 * GUI_GRID_H + GUI_GRID_Y;
w = 3 * GUI_GRID_W;
Expand Down
5 changes: 3 additions & 2 deletions HG/UI/HG_IDCS.h
Expand Up @@ -22,8 +22,9 @@
#define HG_VEHICLES_SWITCH_IDC 6002
#define HG_VEHICLES_LIST_IDC 6003
#define HG_VEHICLES_SP_IDC 6004
#define HG_VEHICLES_BUY_IDC 6005
#define HG_VEHICLES_MC_IDC 6006
#define HG_VEHICLES_TG_IDC 6005
#define HG_VEHICLES_BUY_IDC 6006
#define HG_VEHICLES_MC_IDC 6007

#define HG_GARAGE_IDD 6100
#define HG_GARAGE_BACK_IDC 6101
Expand Down
18 changes: 17 additions & 1 deletion stringtable.xml
Expand Up @@ -25,6 +25,14 @@
<Spanish></Spanish>
<Italian></Italian>
</Key>
<Key ID="STR_HG_VEHICLE_BOUGHT_TO_GARAGE">
<Original>You have bought a %1 for %2, it has been stored in your garage</Original>
<French></French>
<German></German>
<Russian></Russian>
<Spanish></Spanish>
<Italian></Italian>
</Key>
<Key ID="STR_HG_NOT_ENOUGH_MONEY">
<Original>You don't have enough money, requires %1</Original>
<French></French>
Expand Down Expand Up @@ -619,7 +627,7 @@
<Italian></Italian>
</Key>
<Key ID="STR_HG_GRG_VEHICLE_SPAWNED">
<Original>Requested vehicle has be spawned</Original>
<Original>Requested vehicle has been spawned</Original>
<French></French>
<German></German>
<Russian></Russian>
Expand Down Expand Up @@ -667,6 +675,14 @@
<Russian></Russian>
<Spanish></Spanish>
<Italian></Italian>
</Key>
<Key ID="STR_HG_DLG_VS_TG_TOOLTIP">
<Original>Buy selected vehicle and store it to garage</Original>
<French></French>
<German></German>
<Russian></Russian>
<Spanish></Spanish>
<Italian></Italian>
</Key>
<Key ID="STR_HG_DLG_VS_BUY_TOOLTIP">
<Original>Buy selected vehicle</Original>
Expand Down

0 comments on commit ef44b0d

Please sign in to comment.