• 0
Sign in to follow this  
leonardos1978

ExAd Hack VG

Question

I try to combine this script with ExaD. I Replaced variable "ExileTerritoryStoredVehicles" to "ExAdVGVeh" and progress has moved, but not done,no vehicles from VG, help me please

What are we have? We are have script, but his for vanilla Exile.

 

Spoiler

private["_sessionID", "_parameters", "_object", "_player", "_hackerUID", "_hackAttempts", "_laptop", "_marker"];
_sessionID = _this select 0;
_parameters = _this select 1;
try 
{    
    _object = objectFromNetId (_parameters select 0);
    if (isNull _object) then 
    {
        throw "Flag object is null."; 
    };
    _player = _sessionID call ExileServer_system_session_getPlayerObject;
    if (isNull _player) then 
    {
        throw "Player is null."; 
    };
    if ((_player distance _object) > 10) then 
    {
        throw "You are too far away."; 
    };
    _hackerUID = _object getVariable ["ExileHackerUID", ""];
    if !(_hackerUID isEqualTo (getPlayerUID _player)) then 
    {
        throw "You aren't the hacker!";    
    };
    if !("Exile_Item_Laptop" in (magazines _player)) then 
    {
        throw "You do not have a laptop."; 
    };
    _hackAttempts = (_object getVariable ["ExileHackAttempts", 0]) + 1;
    _object setVariable ["ExileHackAttempts", _hackAttempts, true];
    _object setVariable ["ExileHackerUID", "", true];
    _player setVariable ["ExileIsHacking", false, true];
    _laptop = _object getVariable ["ExileHackerLaptop", objNull];
    if !(isNull _laptop) then 
    {
        deleteVehicle _laptop;
    };
    _marker = _object getVariable ["ExileHackingMarker", nil];
    if !(isNil "_marker") then 
    {
        deleteMarker _marker;
    };
    
    _territoryID = _object getVariable ["ExileDatabaseID", -1];

    _storedVehicles = _object getVariable ["ExAdVGVeh", []];
    _storedVehicleRandom = selectRandom (_storedVehicles);
    _index = -1;
    {
        if (toLower(_x select 1) isEqualTo toLower(_storedVehicleRandom select 1)) exitWith 
        {
            _index = _forEachIndex;    
        };
    }
    forEach _storedVehicles;
    if (_index isEqualTo -1) then 
    {
        throw "Unable to find vehicle in stored vehicles";
    };    
    _vehicleInfo = format["confirmVehicleOwnership:%1", _storedVehicleRandom select 1] call ExileServer_system_database_query_selectSingle;


    _storedVehicles deleteAt _index;
    _object setVariable ["ExAdVGVeh", _storedVehicles, true];
    format["retrieveVehicle:%1", _vehicleInfo select 0] call ExileServer_system_database_query_fireAndForget;
    _vehicleObject = (_vehicleInfo select 0) call ExileServer_object_vehicle_database_load;
    
    _vehicleObject setVariable ["ExileIsLocked", 0];
    _vehicleObject lock 0;
    _vehicleObject enableRopeAttach true;
    
    _vehicleObject call ExileServer_object_vehicle_database_update;

    [_sessionID, "toastRequest", ["SuccessTitleAndText", ["Hacking Success!", format ["You got a %1 from the garage!", getText (configfile >> "CfgVehicles" >> (typeOf _vehicleObject) >> "displayName")]]]] call ExileServer_system_network_send_to;
}
catch 
{
    [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Hacking failed!", _exception]]] call ExileServer_system_network_send_to;
};

ExAd have

Spoiler

/*  
    fn_VGLoad.sqf
    
    Copyright 2016 Jan Babor

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

private ["_objVehNetId","_objVeh","_flagNetId","_flag","_objVehId","_flagId","_data","_extDB2Message","_vehList"];

_objId = [_this,0,"",[""]] call BIS_fnc_param;
_flagNetId = [_this,1,"",[""]] call BIS_fnc_param;
_playerNetId = [_this,2,"",[""]] call BIS_fnc_param;
_flag = objectFromNetId _flagNetId;
_player = objectFromNetId _playerNetId;
_requestFrom = owner _player;

_proceed = false;
_vehList = _flag getVariable ["ExAdVGVeh", []];

{
    if((format["%1",_x select 0]) isEqualTo _objId)exitWith{
        _vehList deleteAt _forEachIndex;
        _proceed = true;
    }
}forEach _vehList;

if(!_proceed)exitWith{[_owner, "toastRequest", ["ErrorTitleAndText", ["ExAd - Virtual Garage", STR_ExAd_VG_NOTI_NOT_AVAILABLE]]] call ExileServer_system_network_send_to};

_flag setVariable ["ExAdVGVeh", _vehList, true];

_vehObj = (parseNumber _objId) call ExileServer_object_vehicle_database_load;
_extDB2Message = ["loadVehFromVG", [parseNumber _objId]] call ExileServer_util_extDB2_createMessage;
_extDB2Message call ExileServer_system_database_query_fireAndForget;

if(ExAd_VG_SHOW_ADVHINT)then{
    [["advancedHint", ["VGLoad",[_vehObj getVariable["ExileAccessCode",""]]]], _requestFrom] call ExAdServer_fnc_clientDispatch;
};

_pos = getPosATL _vehObj;
_pos set [2, (_pos select 2) + 0.1];
_vehObj setPosATL _pos;
_vehObj setVectorUp [0,0,1];
["VirtualGarage", format["Spawned: Player - %1(%2)|Vehicle - %3(%4)|",name _player, getPlayerUID _player, typeOf _vehObj, _objId]] call ExAdServer_fnc_log;

true

 

Share this post


Link to post
Share on other sites

0 answers to this question

There have been no answers to this question yet

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.