Hi. I'm trying to get this script, written by Kevin Webb. I was sad to learn that he ceased to maintain this script.
Directly to the cause.
1. I added the button itself in chop shop menu:
CSS
class BtnSteal : Life_RscButtonMenu
{
idc = -1;
text = "Make Yours";
colorBackground[] = {0,0.2235294117647059,0.3725490196078431,1};
onButtonclick = "[] spawn life_fnc_stealVehicle;";
x = 0.1 + (((6.25 / 40) + (1 / 250 / (safezoneW / safezoneH)))*2);
y = 0.8 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
Alles anzeigen
2. fn_stealVehicle.sqf
SQL
/*
File: fn_stealVehicle.sqf
Author: Kevin Webb
Description: Allows the player to put a stolen vehicle in his garage.
*/
disableSerialization;
private["_control","_price","_vehicle","_nearVehicles","_color","_pid","_check"];
_control = ((findDisplay 39400) displayCtrl 39402);
_price = _control lbValue (lbCurSel _control);
_price = _price*0.65;
_pid = getPlayerUID player;
if(life_cash < _price) exitWith {hint format["We require a fee of %1 to make that vehicle yours",_price]; };
_vehicle = _control lbData (lbCurSel _control);
_vehicle = call compile format["%1", _vehicle];
_nearVehicles = nearestObjects [getMarkerPos life_chopShop,["Car","Truck"],25];
_vehicle = _nearVehicles select _vehicle;
_vehicleName = getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName");
if(isNull _vehicle) exitWith {};
_check = false;
{if(player distance _x < 200 && side _x == west) then { _check = true; };} forEach playableUnits;
if(_check) exitWith {hint "The cops are too close to complete this action!";};
//EDIT HERE
if(typeOf _vehicle == "B_MRAP_01_F") exitWith {hint "Unfortunately, you can not make that type of vehicle yours! You will have to sell it instead."; };
_color = 0;
if(typeOf _vehicle in["C_Offroad_01_F"]) then { _color = floor(random 12); };
while {typeOf _vehicle in["C_Offroad_01_F"] && _color in [6,7,8]} do {_color = floor(random 12); };
if(typeOf _vehicle in["C_Hatchback_01_F"]) then { _color = floor(random 7); };
if(typeOf _vehicle in["C_Hatchback_01_sport_F"]) then { _color = floor(random 6); };
if(typeOf _vehicle in["C_SUV_01_F"]) then { _color = floor(random 8); };
while {typeOf _vehicle in["C_SUV_01_F"] && _color in[1,4,5]} do { _color = floor(random 8); };
if(typeOf _vehicle in["B_Quadbike_01_F"]) then { _color = floor(random 9); };
_upp = format["Interrupting a... %1",_vehicleName];
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0;
while{true} do
{
sleep 0.2;
_cP = _cP + 0.003;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if(speed player > 1 OR !alive player OR life_istazed OR vehicle player != player OR life_knockout OR life_interrupted) exitWith {_check = true;};
if(_cP >= 1) exitWith {};
};
5 cutText ["","PLAIN"];
if(_check) exitWith {hint "Cutaway interrupted";};
hint format["You have been charged %1 for this transaction and the vehicle has been added to your garage",_price];
[[_vehicle],"TON_fnc_vehicleIsDead",false,false] spawn life_fnc_MP;
sleep 0.05;
[[(getPlayerUID player),playerSide,_vehicle,_color,1],"TON_fnc_vehicleCreate",false,false] spawn life_fnc_MP;
closeDialog 0;
sleep 0.5;
sleep 0.5;
if(!isNil "_vehicle" && !isNull _vehicle) then { deleteVehicle _vehicle; };
Alles anzeigen
3. server file fn_vehicleIsDead.sqf
SQL
/*
File: fn_vehicleIsDead.sqf
Author: Kevin Webb
Description:
Used for the copCrush function: deletes the vehicle from the database.
*/
private["_vehicle","_plate","_uid","_query","_sql","_dbInfo","_thread"];
_vehicle = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
if(isNull _vehicle) exitWith {}; //NULL
_dbInfo = _vehicle getVariable["dbInfo",[]];
if(count _dbInfo == 0) exitWith {};
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
_query = format["UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'",_uid,_plate];
waitUntil {!DB_Async_Active};
_thread = [_query,1] call DB_fnc_asyncCall;
sleep 0.6;
if(!isNil "_vehicle" && {!isNull _vehicle}) then {
deleteVehicle _vehicle;
};
Alles anzeigen
Data files ordered in Functions and config.cpp.
Now the very principle of work. Deletes the vehicle from the old owner's garage, creates a new one in the new owner's garage.
I have just lost a car (and should be). According to venture, it must appear in the garage, but it's not. Record in the database appears.
Forgot to say. After you restart the server machine has appeared at the civilian and police. Although must immediately retire civil police and be added.