Hi,
ich bin langsam aber sicher am Verzweifeln. Vielleicht habt ihr ja eine Idee. Ich versuche auf einen Wert in lbData zu zugreifen aber das klappt irgendwie nicht.
Code: veh_repaint.hpp
class Life_vehicle_repaint {
idd = 2300;
name= "life_vehrepaint_menu";
movingEnable = false;
enableSimulation = true;
//onLoad = "[] execVM 'core\client\keychain\init.sqf'";
class controlsBackground {
class Life_RscTitleBackground:Life_RscText {
colorBackground[] = {0.4, 0, 0, 0.7};
idc = -1;
x = 0.1;
y = 0.2;
w = 0.8;
h = (1 / 25);
};
class MainBackground:Life_RscText {
colorBackground[] = {0, 0, 0, 0.7};
idc = -1;
x = 0.1;
y = 0.2 + (11 / 250);
w = 0.8;
h = 0.6 - (22 / 250);
};
};
class controls {
class Title : Life_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = 2301;
text = "Auto umlackierung";
x = 0.1;
y = 0.2;
w = 0.8;
h = (1 / 25);
};
class VehicleList : Life_RscListBox
{
idc = 2302;
text = "";
sizeEx = 0.035;
colorBackground[] = {0,0,0,0};
onLBSelChanged = "[_this] call life_fnc_Repaintcolor";
x = 0.12; y = 0.26;
w = 0.76; h = 0.4;
};
class ColorList : Life_RscCombo
{
idc = 2303;
x = 0.42; y = 0.68;
w = 0.275; h = 0.03;
};
class CloseButtonKey : Life_RscButtonMenu {
idc = -1;
text = "$STR_Global_Close";
onButtonClick = "closeDialog 0;";
x = -0.06 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.8 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class RepaintCar : life_RscButtonMenu {
idc = -1;
text = "Repaint ($20000)";
onButtonClick = "[] spawn life_fnc_RepaintVehicle;";
x = 0.26 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.8 - (1 / 25);
w = (10 / 40);
h = (1 / 25);
};
};
};
Alles anzeigen
Code: fn_repaintvehicle.sqf
/*
File: fn_RepaintVehicle.sqf
Author: MooN-Gaming
Description: Does the active repaint man....read the title!
*/
private["_index","_veh","_color","_color_index","_testdata"];
if(!isNull (findDisplay 2300)) then {
_testdata=lbdata [2303,lbcursel 2303];
hint format["lbc: %1 || lbvalue: %2",_testlbcursel,_testlbvalue];
_veh = nearestObject [position player, _testdata];
_color = lbcursel 2303;
_color_index = lbValue[2303,_color];
closeDialog 0;
_baseprice = 20000;
_vehicleData = _veh getVariable["vehicle_info_owners",[]];
_vehOwner = (_vehicleData select 0) select 0;
if(life_6cash < _basePrice) exitWith {hint "Du hast keine 20000$ um den Lackierer zu bezahlen."};
if(isNil {_vehicleData}) exitWith {hint "Es gibt keine Infos zu diesem Fahrzeug, es ist entweder gemietet oder gecheated."};
if ((getPlayerUID player) != _vehOwner) exitWith {hint "Du bist nicht der Besitzer des Fahrzeugs das lackiert werden soll."};
life_action_inUse = true;
//[player,"spraycan"] call life_fnc_globalSound;
_displayName = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "displayName");
_upp = format["Lackiere %1",_displayName];
//Setup our progress bar.
disableSerialization;
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.01;
while{true} do
{
if(animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
[[player,"AinvPknlMstpSnonWnonDnon_medic_1"],"life_fnc_animSync",true,false] spawn life_fnc_MP;
player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
};
sleep 0.29;
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if(_cP >= 1) exitWith {};
if(!alive player) exitWith {};
if(player != vehicle player) exitWith {};
if(life_interrupted) exitWith {};
};
life_action_inUse = false;
5 cutText ["","PLAIN"];
player playActionNow "stop";
if(life_interrupted) exitWith {life_interrupted = false; titleText["Abgebrochen!","PLAIN"]; life_action_inUse = false;};
if(player != vehicle player) exitWith {titleText["Du musst aus dem Fahrzeug aussteigen, um es lackieren zu können!","PLAIN"];};
life_6cash = life_6cash - _basePrice;
//Send toDB
[[_veh,_color_index],"TON_fnc_vehicleRepaint",false,false] spawn life_fnc_MP;
//Color vehicle locally
[_veh,_color_index] call life_fnc_colorVehicle;
[] call SOCK_fnc_updateRequest; //Sync silently because it's obviously silently..
hint format["Fahrzeug: %1 || Neue Farbe: %2 || Besitzer: %3",_veh,_color_index,_vehicledata];
};
Alles anzeigen
Code: fn_repaintmenu.sqf
/*
File: fn_RepaintMenu.sqf
Author: MooN-Gaming
Description: What could it do bro?!
*/
private["_display","_vehicles","_objects","_color","_haha","_pic","_text","_owners"];
createDialog "Life_vehicle_repaint";
disableSerialization;
if(!isNull (findDisplay 2300)) then {
_display = findDisplay 2300;
_vehicles = _display displayCtrl 2302;
_objects = nearestObjects[getPos (_this select 0),["Car","Air","Ship"],20];
//_objects = nearestObject [position player, "LandVehicle"];
_xx = _objects select 0;
//List vehicles
{
if(vehicle player != _x) then {
_color = [(typeOf _xx),(_xx getVariable "Life_VEH_color")] call life_fnc_vehicleColorStr;
_pic = getText(configFile >> "CfgVehicles" >> typeOf _x >> "picture");
_text = format["(%1)",_color];
_haha = typeOf _x;
if(_text == "()") then
{
_text = "";
};
_vehicles lbAdd format ["%1 || %2", getText(configFile >> "cfgVehicles" >> typeOf _x >> "DisplayName"), _text];
_vehicles lbSetPicture [(lbSize _vehicles)-1,_pic];
_vehicles lbSetData [(lbSize _vehicles)-1,_haha];
};
} foreach _objects;
};
Alles anzeigen
Also ich versuche aus dem Menü das Fahrzeug an die RepaintVehicle zu übergeben. Allerdings scheitere ich jedes mal.
Danke,
moeck