Hier mein Part.
das ganze ist für SQL_Custom gemacht worden.
Code
[changePlate]
SQL1_1 = UPDATE vehicles SET plate = ? WHERE pid = ? AND id = ?
SQL1_INPUTS = 1, 2, 3
[getNamePlate]
SQL1_1 = SELECT owner FROM vehicles WHERE plate = ?
SQL1_INPUTS = 1
OUTPUT = 1-STRING
einmal die fn_vehicleShopBuy geändert.
Spoiler anzeigen
Code
#include "..\..\script_macros.hpp"
/*
File: fn_vehicleShopBuy.sqf
Author: Bryan "Tonic" Boardwine
Description:
Does something with vehicle purchasing.
*/
params [["_mode",true,[true]]];
if ((lbCurSel 2302) isEqualTo -1) exitWith {[localize "STR_Shop_Veh_DidntPick","fast","red"] spawn TLG_Client_fnc_msgHandle; closeDialog 0;};
private _className = lbData[2302,(lbCurSel 2302)];
private _vIndex = lbValue[2302,(lbCurSel 2302)];
private _vehicleList = M_CONFIG(getArray,"CarShops",(life_veh_shop select 0),"vehicles");
private _shopSide = M_CONFIG(getText,"CarShops",(life_veh_shop select 0),"side");
private _initalPrice = M_CONFIG(getNumber,"LifeCfgVehicles",_className,"price");
private "_buyMultiplier";
private "_rentMultiplier";
switch (playerSide) do {
case civilian: {
_buyMultiplier = LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
_rentMultiplier = LIFE_SETTINGS(getNumber,"vehicle_rental_multiplier_CIVILIAN");
};
case west: {
_buyMultiplier = LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
_rentMultiplier = LIFE_SETTINGS(getNumber,"vehicle_rental_multiplier_COP");
};
case independent: {
_buyMultiplier = LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
_rentMultiplier = LIFE_SETTINGS(getNumber,"vehicle_rental_multiplier_MEDIC");
};
case east: {
_buyMultiplier = LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
_rentMultiplier = LIFE_SETTINGS(getNumber,"vehicle_rental_multiplier_OPFOR");
};
};
private "_purchasePrice";
if (_mode) then {
_purchasePrice = round(_initalPrice * _buyMultiplier);
} else {
_purchasePrice = round(_initalPrice * _rentMultiplier);
};
private _conditions = M_CONFIG(getText,"LifeCfgVehicles",_className,"conditions");
if !([_conditions] call life_fnc_levelCheck) exitWith {[localize "STR_Shop_Veh_NoLicense","fast","red"] spawn TLG_Client_fnc_msgHandle;};
private _colorIndex = lbValue[2304,(lbCurSel 2304)];
if (_purchasePrice < 0) exitWith {closeDialog 0;}; //Bad price entry
if (CASH < _purchasePrice) exitWith {[format [localize "STR_Shop_Veh_NotEnough",[_purchasePrice - CASH] call life_fnc_numberText],"fast","red"] spawn TLG_Client_fnc_msgHandle;closeDialog 0;};
private _spawnPoints = life_veh_shop select 1;
private _spawnPoint = "";
if ((life_veh_shop select 0) == "med_air_hs") then {
if (nearestObjects[(getMarkerPos _spawnPoints),["Air"],35] isEqualTo []) exitWith {_spawnPoint = _spawnPoints};
} else {
//Check if there is multiple spawn points and find a suitable spawnpoint.
if (_spawnPoints isEqualType []) then {
//Find an available spawn point.
{
if ((nearestObjects[(getMarkerPos _x),["Car","Ship","Air"],5]) isEqualTo []) exitWith {_spawnPoint = _x};
true
} count _spawnPoints;
} else {
if (nearestObjects[(getMarkerPos _spawnPoints),["Car","Ship","Air"],5] isEqualTo []) exitWith {_spawnPoint = _spawnPoints};
};
};
if (_spawnPoint isEqualTo "") exitWith {[localize "STR_Shop_Veh_Block","fast","red"] spawn TLG_Client_fnc_msgHandle; closeDialog 0;};
CASH = CASH - _purchasePrice;
0 call SOCK_fnc_updatePartial;
[format [localize "STR_Shop_Veh_Bought",getText(configFile >> "CfgVehicles" >> _className >> "displayName"),[_purchasePrice] call life_fnc_numberText],"fast","blue"] spawn TLG_Client_fnc_msgHandle;
//Spawn the vehicle and prep it.
private "_vehicle";
if ((life_veh_shop select 0) == "med_air_hs") then {
_vehicle = createVehicle [_className,[0,0,999],[], 0, "NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}}; //Wait?
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _spawnPoint,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
sleep 0.6;
} else {
_vehicle = createVehicle [_className, (getMarkerPos _spawnPoint), [], 0, "NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}}; //Wait?
_vehicle allowDamage false; //Temp disable damage handling..
_vehicle setPos (getMarkerPos _spawnPoint);
_vehicle setVectorUp (surfaceNormal (getMarkerPos _spawnPoint));
_vehicle setDir (markerDir _spawnPoint);
};
_vehicle lock 2;
[_vehicle,_colorIndex] call life_fnc_colorVehicle;
[_vehicle] call life_fnc_clearVehicleAmmo;
[_vehicle,"trunk_in_use",false,true] remoteExecCall ["TON_fnc_setObjVar",RSERV];
[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true] remoteExecCall ["TON_fnc_setObjVar",RSERV];
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
//Side Specific actions.
switch (playerSide) do {
case west: {
[_vehicle,"cop_offroad",true] spawn life_fnc_vehicleAnimate;
};
case civilian: {
if ((life_veh_shop select 2) isEqualTo "civ" && {_className == "B_Heli_Light_01_F"}) then {
[_vehicle,"civ_littlebird",true] spawn life_fnc_vehicleAnimate;
};
};
case independent: {
[_vehicle,"med_offroad",true] spawn life_fnc_vehicleAnimate;
};
};
_char1 = selectRandom ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
_char2 = selectRandom ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
_vehicle setPlateNumber format["TLG-%1%2-%3",_char1,_char2,round(random(1000000))];
_vehicle allowDamage true;
private _plate = getPlateNumber _vehicle;
private _vehicleOwner = name player;
life_vehicles pushBack _vehicle;
//Always handle key management by the server
[getPlayerUID player,playerSide,_vehicle,1] remoteExecCall ["TON_fnc_keyManagement",RSERV];
if (_mode) then {
if !(_className in LIFE_SETTINGS(getArray,"vehicleShop_rentalOnly")) then {
if (life_HC_isActive) then {
[(getPlayerUID player),playerSide,_vehicle,_colorIndex,_plate,_vehicleOwner] remoteExecCall ["HC_fnc_vehicleCreate",HC_Life];
} else {
[(getPlayerUID player),playerSide,_vehicle,_colorIndex,_plate,_vehicleOwner] remoteExecCall ["TON_fnc_vehicleCreate",RSERV];
};
};
};
if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
advanced_log = format [localize "STR_DL_AL_boughtVehicle_BEF",_className,[_purchasePrice] call life_fnc_numberText,[CASH] call life_fnc_numberText,[BANK] call life_fnc_numberText];
} else {
advanced_log = format [localize "STR_DL_AL_boughtVehicle",profileName,(getPlayerUID player),_className,[_purchasePrice] call life_fnc_numberText,[CASH] call life_fnc_numberText,[BANK] call life_fnc_numberText];
};
publicVariableServer "advanced_log";
};
["VehiclePurchased"] spawn mav_ttm_fnc_addExp;
closeDialog 0; //Exit the menu.
true;
Alles anzeigen
die fn_garageLBChange
Spoiler anzeigen
Code
#include "..\..\script_macros.hpp"
/*
File: fn_garageLBChange.sqf
Author: Bryan "Tonic" Boardwine
Description:
Can't be bothered to answer it.. Already deleted it by accident..
*/
disableSerialization;
params[
"_control",
"_index"
];
//Fetch some information.
private _dataArr = CONTROL_DATAI(_control,_index);
_dataArr = call compile format ["%1",_dataArr];
private _className = (_dataArr select 0);
private _classNameLife = _className;
private _insurance = (_dataArr select 3);
private _plate = (_dataArr select 2);
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
_classNameLife = "Default"; //Use Default class if it doesn't exist
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
};
private _vehicleColor = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select (_dataArr select 1)) select 0);
if (isNil "_vehicleColor") then {_vehicleColor = "Default";};
private _vehicleInfo = [_className] call life_fnc_fetchVehInfo;
private _trunkSpace = [_className] call life_fnc_vehicleWeightCfg;
private _price = M_CONFIG(getNumber,"LifeCfgVehicles",_classNameLife,"price");
private _storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
private "_sellMultiplier";
private "_insuranceMultiplier";
private "_purchasePrice";
switch (playerSide) do {
case civilian: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
_insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_CIVILIAN");
};
case west: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
_insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP");
};
case independent: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
_insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC");
};
case east: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
_insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR");
};
};
private _retrievePrice = _purchasePrice * _storageFee;
private _sellPrice = _purchasePrice * _sellMultiplier;
private _insurancePrice = _purchasePrice * _insuranceMultiplier;
if (!(_sellPrice isEqualType 0) || _sellPrice < 1) then {_sellPrice = 500;};
if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;};
if (!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500;};
(CONTROL(2800,2803)) ctrlSetStructuredText parseText format[
(localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/>
" +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/>
Preis der Versicherung: <t color='#8cff9b'>$%9</t><br/>
Versicherungszustand: %10<br/>
Kennzeichen: %12<br/>
" +(localize "STR_Shop_Veh_UI_Color")+ " <t color='#8cff9b'>%8</t><br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " <t color='#8cff9b'>%3 km/h</t><br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " <t color='#8cff9b'>%4</t><br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " <t color='#8cff9b'>%5</t><br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " <t color='#8cff9b'>%6</t><br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " <t color='#8cff9b'>%7</t>
",
[_retrievePrice] call life_fnc_numberText,
[_sellPrice] call life_fnc_numberText,
(_vehicleInfo select 8),
(_vehicleInfo select 11),
(_vehicleInfo select 10),
if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
(_vehicleInfo select 12),
_vehicleColor,
[_insurancePrice] call life_fnc_numberText,
if(_insurance == 1) then {"<t color='#8cff9b'>Versichert</t>"} else {"<t color='#FF0000'>nicht Versichert</t>"},
(_vehicleInfo select 9),
_plate
];
if(_insurance == 1) then {
ctrlShow [97480,False];
}else{
ctrlShow [97480,True];
};
ctrlShow [2803,true];
ctrlShow [2830,true];
Alles anzeigen
die fn_impoundMenu
Spoiler anzeigen
Code
#include "..\..\script_macros.hpp"
/*
File: fn_impoundMenu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Not actually a impound menu, may act as confusion to some but that is what I wanted.
The purpose of this menu is it is now called a 'Garage' where vehicles are stored (persistent ones).
*/
disableSerialization;
private _vehicles = param [0,[],[[]]];
ctrlShow[2803,false];
ctrlShow[2830,false];
waitUntil {!isNull (findDisplay 2800)};
if (count _vehicles isEqualTo 0) exitWith {
ctrlSetText[2811,localize "STR_Garage_NoVehicles"];
};
private _control = CONTROL(2800,2802);
lbClear _control;
{
_vehicleInfo = [(_x select 2)] call life_fnc_fetchVehInfo;
_control lbAdd (_vehicleInfo select 3);
_tmp = [(_x select 2),(_x select 8),(_x select 7),(_x select 9)];
_tmp = str(_tmp);
_control lbSetData [(lbSize _control)-1,_tmp];
_control lbSetPicture [(lbSize _control)-1,(_vehicleInfo select 2)];
_control lbSetValue [(lbSize _control)-1,(_x select 0)];
} forEach _vehicles;
ctrlShow[2810,false];
ctrlShow[2811,false];
Alles anzeigen
neue Datei im life_server fn_Plate
Spoiler anzeigen
die fn_vehicleCreate
Spoiler anzeigen
Code
/*
File: fn_vehicleCreate.sqf
Author: Bryan "Tonic" Boardwine
Description:
Answers the query request to create the vehicle in the database.
*/
params [
["_uid", "", [""]],
["_side", sideUnknown, [west]],
["_vehicle", objNull, [objNull]],
["_color", -1, [0]],
["_plate", "", [""]],
"_vehicleOwner"
];
//Error checks
if (_uid isEqualTo "" || {_side isEqualTo sideUnknown} || {isNull _vehicle}) exitWith {};
if (!alive _vehicle) exitWith {};
private _className = typeOf _vehicle;
private _type = switch (true) do {
case (_vehicle isKindOf "Car"): {"Car"};
case (_vehicle isKindOf "Air"): {"Air"};
case (_vehicle isKindOf "Ship"): {"Ship"};
};
_side = switch (_side) do {
case west:{"cop"};
case civilian: {"civ"};
case independent: {"med"};
case east: {"adac"};
default {"Error"};
};
[_uid, _side, _type, _classname, _color, _plate, _vehicleOwner] call DB_fnc_insertVehicle;
_vehicle setVariable ["dbInfo", [_uid, _plate], true];
Alles anzeigen
die fn_insertVehicle
Spoiler anzeigen
Code
/*
File: fn_insertVehicle.sqf
Author: Bryan "Tonic" Boardwine
Description:
Inserts the vehicle into the database
*/
params [
"_uid",
"_side",
"_type",
"_className",
["_color",-1,[0]],
["_plate", "", [""]],
"_vehicleOwner"
];
//Stop bad data being passed.
if (_uid isEqualTo "" || {_side isEqualTo ""} || {_type isEqualTo ""} || {_className isEqualTo ""} || {_color isEqualTo -1} || {_plate isEqualTo ""}) exitWith {};
private _query = format ["insertVehicle:%1:%2:%3:%4:%5:%6:%7", _side, _className, _type, _uid, _color, _plate, _vehicleOwner];
[_query, 1] call DB_fnc_asyncCall;
Alles anzeigen