geekm0nkey

New XM8 App coding?

183 posts in this topic

Comment out or delete the line

ExileClient_gui_xm8_slide = "ExAdClient\XM8\CustomCode\ExileClient_gui_xm8_slide.sqf";

in the config.cpp file of your mission .pbo

Share this post


Link to post
Share on other sites
On 3/13/2018 at 8:45 AM, Beowulfv said:

So it's no secret that I hate Exiles version of the Virtual Garage, so I'm sticking with ExAds. However I can't stand there being two apps for Virtual Garage, so let re-purpose that main VG app button. For this you will need to follow the first step in Spazz711 instructions. You're not creating an App button for this.

We will be creating an overwrite for ExileClient_gui_virtualGarageDialog_show and we'll be using the 3 original overwrites for ExAd:

  Reveal hidden contents

//ExAd
ExileServer_system_territory_database_load = "ExAdClient\VirtualGarage\CustomCode\ExileServer_system_territory_database_load.sqf";
ExileClient_gui_virtualGarageDialog_show = "overwrites\ExileClient_gui_virtualGarageDialog_show.sqf";
ExileClient_gui_xm8_slide = "ExAdClient\XM8\CustomCode\ExileClient_gui_xm8_slide.sqf";
ExileClient_gui_xm8_show = "ExAdClient\XM8\CustomCode\ExileClient_gui_xm8_show.sqf";

Add this to your ExileClient_gui_virtualGarageDialog_show overwrite
 

  Reveal hidden contents

private["_flag", "_buildRights", "_territoryLevel", "_maxNumberOfVehicles", "_control"];
disableSerialization;
try 
{
    if ((getNumber(missionConfigFile >> 'CfgVirtualGarage' >> 'enableVirtualGarage')) isEqualTo 0) then 
    {
        throw "This server has Virtual Garage disabled! Ask the server owner to enable it!";
    };
    if ((getNumber(missionConfigFile >> "CfgVirtualGarage" >> "canAccessGarageInCombat") isEqualTo 1) && {ExileClientPlayerIsInCombat}) then 
    {
        throw "You cannot access Virtual Garage while in combat!";    
    };
    _flag = player call ExileClient_util_world_getTerritoryAtPosition;
    if (isNull _flag) then 
    {
        throw "You must be in your territory in order to access Virtual Garage";
    };
    _buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
    if !((getPlayerUID player) in _buildRights) then 
    {
        throw "You do not have permission to access this territory's Virtual Garage";
    };
    _control = ['ExAd_VG', 0] call ExileClient_gui_xm8_slide;
}
catch 
{
    [_exception, 'Okay'] call ExileClient_gui_xm8_showWarning;
};
true

This setup still uses the Exile Config settings in your mission config minus the number of vehicles allowed. I left the other checks in for more customization options, so make sure you have a 1 next to enableVirtualGarage in your config or you'll get the first message.

Uh oh, when we click back on the VG screen it takes us back to ExtraApps. Lets fix that. Go to mission >> ExAdClient >> XM8 >> Apps >> VG and edit onLoad.sqf

  Reveal hidden contents

Locate this line (should be line 28):
[_display,_slide,(["ExAd_VG","backButton"] call ExAd_fnc_getNextIDC),[27.6 * _pW, 17.7 * _pH, 6 * _pW, 1 * _pH],'["extraApps", 1] call ExileClient_gui_xm8_slide;',STR_ExAd_VG_APP_BTN_BACK] call ExAd_fnc_createButton;

And change it to this:
[_display,_slide,(["ExAd_VG","backButton"] call ExAd_fnc_getNextIDC),[27.6 * _pW, 17.7 * _pH, 6 * _pW, 1 * _pH],'["apps", 1] call ExileClient_gui_xm8_slide;',STR_ExAd_VG_APP_BTN_BACK] call ExAd_fnc_createButton;

If you've implemented Exiles VG then this may not work correctly. You'll need to edit your exile.ini and database to be compatible. Also there is a bug with vehicles previously in the database when updating to 1.0.4 just run this SQL query after updating and it will fix the issue:
 

  Reveal hidden contents

UPDATE Vehicle SET deleted_at = NULL WHERE deleted_at IS NOT NULL AND territory_id IS NOT NULL

 

 

On 3/13/2018 at 11:07 AM, Beowulfv said:

People who have already updated to 1.0.4 should only need to run this query:

  Reveal hidden contents

ALTER TABLE `vehicle` DROP `nickname`;

But even having that in the database shouldn't cause any issues. This is the exile.ini if needed:
 

  Reveal hidden contents

;1. Find following sections and replace the commented lines;

[loadVehicleIdPage]
SQL1_1 = SELECT id FROM vehicle WHERE deleted_at IS NULL AND territory_id IS NULL LIMIT ?,?
Number Of Inputs = 2
SQL1_INPUTS = 1,2
OUTPUT = 1    

; Removes vehicles that were not used within ? days
[deleteOldVehicles]
SQL1_1 = DELETE FROM vehicle WHERE territory_id IS NULL AND deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY)
Number Of Inputs = 1
SQL1_INPUTS = 1

; Marks for deletion vehicles that were not used within ? days
[markDeleteOldVehicles]
SQL1_1 = UPDATE vehicle SET deleted_at = NOW() WHERE last_updated_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND deleted_at IS NULL AND territory_id IS NULL
Number Of Inputs = 1
SQL1_INPUTS = 1

;2. Add all below in the end of the file.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Virtual Garage related queries | ADDED BY [ExAd]Jan
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[loadTerritoryVehicles]
SQL1_1 = SELECT id, class FROM vehicle WHERE territory_id = ?
Number Of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1,2-STRING

[loadVehFromVG]
SQL1_1 = UPDATE vehicle SET territory_id = NULL WHERE id = ?
Number Of Inputs = 1
SQL1_INPUTS = 1

[loadVehToVG]
SQL1_1 = UPDATE vehicle SET territory_id = ? WHERE id = ?
Number Of Inputs = 2
SQL1_INPUTS = 1,2

And remove these:
 

  Reveal hidden contents

[storeVehicle]
SQL1_1 = UPDATE vehicle SET territory_id = ?, nickname = ?, last_updated_at = NOW() WHERE id = ?
Number of Inputs = 3
SQL1_INPUTS = 1,2,3

[retrieveVehicle]
SQL1_1 = UPDATE vehicle SET territory_id = NULL, last_updated_at = NOW(), nickname = '' WHERE id = ?
Number of Inputs = 1
SQL1_INPUTS = 1

[confirmVehicleOwnership]
SQL1_1 = SELECT id, territory_id FROM vehicle WHERE nickname = ?
Number of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1,2

[loadTerritoryVirtualGarage]
SQL1_1 = SELECT class, nickname FROM vehicle WHERE territory_id = ?
Number of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1-STRING,2-STRING

 

this together will work!

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.