Guten Tag zusammen,
man, ich schreibe im Moment oft ![]()
Ich habe ein Problem mit den virtuellen Shops. Sie funktionieren nicht. Sie sind ordnungsgemäß eingetragen oder ich habe etwas vergessen. Bräuchte da mal wirklich Hilfe.
Hier meine Dateien.
fn_virt_shops.sqf
Spoiler anzeigen
/*
File: fn_virt_shops.sqf
Author: Bryan "Tonic" Boardwine
Description:
Config for virtual shops.
*/
private["_shop"];
_shop = _this select 0;
switch (_shop) do
{
case "market": {["Markt",["water","rabbit","apple","storagebig","storagesmall","bottledbeer","bottledwhiskey","redgull","battery","tbacon","lockpick","pickaxe","zipties","peach","boltcutter","blastingcharge"]]};
case "rebel": {["Rebellen Market",["water","rabbit","apple","redgull","tbacon","lockpick","pickaxe","fuelF","peach","boltcutter","blastingcharge"]]};
case "gang": {["Gang Market", ["water","rabbit","apple","redgull","tbacon","lockpick","pickaxe","fuelF","peach","blastingcharge","boltcutter"]]};
case "wongs": {["Wong's Food Cart",["turtlesoup","turtle","moonshine"]]};
case "coffee": {["Stratis Coffee Club",["coffee","donuts"]]};
case "heroin": {["Drug Dealer",["cocainep","heroinp","marijuana","methp"]]};
case "fishmarket": {["Altis Fish Market",["salema","ornate","mackerel","mullet","tuna","catshark"]]};
case "glass": {["Altis Glass Dealer",["glass"]]};
case "iron": {["Altis Industrial Trader",["iron_r","copper_r"]]};
case "diamond": {["Diamond Dealer",["diamond","diamondc"]]};
case "salt": {["Salt Dealer",["salt_r"]]};
case "cop": {["Cop Item Shop",["donuts","coffee","spikeStrip","mauer","battery","painkillers","redgull","defusekit"]]};
case "cement": {["Cement Dealer",["cement"]]};
case "beer": {["Schnaps Laden",["wine"]]};
case "pharmacy": {["Apotheke",["painkillers","morphium","scalpel","kidney"]]};
case "medic": {["Arztbedarf",["apple","donuts","coffee","battery","redgull","fuelF"]]};
case "speakeasy": {["Speakeasy's",["bottledbeer","bottledwhiskey","bottledshine"]]};
case "bar": {["The Lounge",["bottles","cornmeal"]]};
case "uranium": {["Marchand Uranium",["uranium","puranium"]]};
};
Dann core\shops\fn_virt_buy.sqf
Spoiler anzeigen
#include <macro.h>
/*
File: fn_virt_buy.sqf
Author: Bryan "Tonic" Boardwine
Description:
Buy a virtual item from the store.
*/
private["_type","_price","_amount","_diff","_name","_hideout"];
if((lbCurSel 2401) == -1) exitWith {hint localize "STR_Shop_Virt_Nothing"};
_type = lbData[2401,(lbCurSel 2401)];
_price = lbValue[2401,(lbCurSel 2401)];
_amount = ctrlText 2404;
if(!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};
_diff = [_type,parseNumber(_amount),life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
_amount = parseNumber(_amount);
if(_diff <= 0) exitWith {hint localize "STR_NOTF_NoSpace"};
_amount = _diff;
_hideout = (nearestObjects[getPosATL player,["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"],25]) select 0;
if((_price * _amount) > life_cash && {!isNil "_hideout" && {!isNil {grpPlayer getVariable "gang_bank"}} && {(grpPlayer getVariable "gang_bank") <= _price * _amount}}) exitWith {hint localize "STR_NOTF_NotEnoughMoney"};
_name = [([_type,0] call life_fnc_varHandle)] call life_fnc_varToStr;
if(([true,_type,_amount] call life_fnc_handleInv)) then
{
if(!isNil "_hideout" && {!isNil {grpPlayer getVariable "gang_bank"}} && {(grpPlayer getVariable "gang_bank") >= _price}) then {
_action = [
format[(localize "STR_Shop_Virt_Gang_FundsMSG")+ "<br/><br/>" +(localize "STR_Shop_Virt_Gang_Funds")+ " <t color='#8cff9b'>$%1</t><br/>" +(localize "STR_Shop_Virt_YourFunds")+ " <t color='#8cff9b'>$%2</t>",
[(grpPlayer getVariable "gang_bank")] call life_fnc_numberText,
[life_cash] call life_fnc_numberText
],
localize "STR_Shop_Virt_YourorGang",
localize "STR_Shop_Virt_UI_GangFunds",
localize "STR_Shop_Virt_UI_YourCash"
] call BIS_fnc_guiMessage;
if(_action) then {
hint format[localize "STR_Shop_Virt_BoughtGang",_amount,_name,[(_price * _amount)] call life_fnc_numberText];
_funds = grpPlayer getVariable "gang_bank";
_funds = _funds - (_price * _amount);
grpPlayer setVariable["gang_bank",_funds,true];
[[1,grpPlayer],"TON_fnc_updateGang",false,false] spawn life_fnc_MP;
} else {
if((_price * _amount) > life_cash) exitWith {[false,_type,_amount] call life_fnc_handleInv; hint localize "STR_NOTF_NotEnoughMoney";};
hint format[localize "STR_Shop_Virt_BoughtItem",_amount,_name,[(_price * _amount)] call life_fnc_numberText];
__SUB__(life_cash,_price * _amount);
[[1,player,life_shop_type,_amount,_price,_type],"TON_fnc_Ajustprices",false,false] spawn life_fnc_MP;
};
} else {
if((_price * _amount) > life_cash) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; [false,_type,_amount] call life_fnc_handleInv;};
hint format[localize "STR_Shop_Virt_BoughtItem",_amount,_name,[(_price * _amount)] call life_fnc_numberText];
__SUB__(life_cash,(_price * _amount));
[[1,player,life_shop_type,_amount,_price,_type],"TON_fnc_Ajustprices",false,false] spawn life_fnc_MP;
};
[] call life_fnc_virt_update;
};
[0] call SOCK_fnc_updatePartial;
[3] call SOCK_fnc_updatePartial;
Danach core\shops\fn_virt_menu.sqf
Spoiler anzeigen
/*
File: fn_virt_menu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initialize the virtual shop menu.
*/
private["_shop"];
_shop = _this select 3;
if(isNil {_shop}) exitWith {};
life_shop_type = _shop;
life_shop_npc = _this select 0;
if(_shop == "cop" && playerSide != west) exitWith {hint localize "STR_NOTF_NotACop"};
createDialog "shops_menu";
[] call life_fnc_virt_update;
Gefolgt von core\shops\fn_virt_sell.sqf
Spoiler anzeigen
#include <macro.h>
/*
File: fn_virt_sell.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sell a virtual item to the store / shop
*/
private["_type","_index","_price","_var","_amount","_name"];
if((lbCurSel 2402) == -1) exitWith {};
_type = lbData[2402,(lbCurSel 2402)];
_price = lbValue[2402,(lbCurSel 2402)];
_var = [_type,0] call life_fnc_varHandle;
_amount = ctrlText 2405;
if(!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};
_amount = parseNumber (_amount);
if(_amount > (missionNameSpace getVariable _var)) exitWith {hint localize "STR_Shop_Virt_NotEnough"};
_price = (_price * _amount);
_name = [_var] call life_fnc_vartostr;
if(([false,_type,_amount] call life_fnc_handleInv)) then
{
hint format[localize "STR_Shop_Virt_SellItem",_amount,_name,[_price] call life_fnc_numberText];
life_cash = life_cash + _price;
[] call life_fnc_virt_update;
};
[[0,player,life_shop_type,_amount,_price,_type],"TON_fnc_Ajustprices",false,false] spawn life_fnc_MP;
if(life_shop_type == "heroin") then
{
private["_array","_ind","_val"];
_array = life_shop_npc getVariable["sellers",[]];
_ind = [getPlayerUID player,_array] call TON_fnc_index;
if(_ind != -1) then
{
_val = (_array select _ind) select 2;
_val = _val + _price;
_array set[_ind,[getPlayerUID player,profileName,_val]];
life_shop_npc setVariable["sellers",_array,true];
}
else
{
_array set[count _array,[getPlayerUID player,profileName,_price]];
life_shop_npc setVariable["sellers",_array,true];
};
};
[0] call SOCK_fnc_updatePartial;
Zunächst core\shops\fn_virt_update.sqf
Spoiler anzeigen
#include <macro.h>
/*
File: fn_virt_update.sqf
Author: Bryan "Tonic" Boardwine
Description:
Update and fill the virtual shop menu.
*/
private["_display","_item_list","_gear_list","_shop_data","_name","_price"];
disableSerialization;
//Setup control vars.
_display = findDisplay 2400;
_item_list = _display displayCtrl 2401;
_gear_list = _display displayCtrl 2402;
//Purge list
lbClear _item_list;
lbClear _gear_list;
_shop_data = [life_shop_type] call life_fnc_virt_shops;
ctrlSetText[2403,format["%1", _shop_data select 0]];
_sender = player;
_uid = getPlayerUID _sender;
[[0,_sender,life_shop_type],"TON_fnc_getprices",false,false] spawn life_fnc_MP;
/*
{
_name = [([_x,0] call life_fnc_varHandle)] call life_fnc_vartostr;
_index = [_x,__GETC__(buy_array)] call TON_fnc_index;
if(_index != -1) then
{
_price = (__GETC__(buy_array) select _index) select 1;
_item_list lbAdd format["%1 ($%2)",_name,[_price] call life_fnc_numberText];
_item_list lbSetData [(lbSize _item_list)-1,_x];
_item_list lbSetValue [(lbSize _item_list)-1,_price];
};
} foreach (_shop_data select 1);
{
_var = [_x,0] call life_fnc_varHandle;
_val = missionNameSpace getVariable _var;
_name = [_var] call life_fnc_vartostr;
if(_val > 0) then
{
_gear_list lbAdd format["%1x %2",_val,_name];
_gear_list lbSetData [(lbSize _gear_list)-1,_x];
};
} foreach (_shop_data select 1);
*/
Und noch die Zeilen aus der Functions.h
Config:
Spoiler anzeigen
class Config
{
file = "core\config";
class licensePrice {};
class vehicleColorCfg {};
class vehicleColorStr {};
class vehicleListCfg {};
class licenseType {};
class eatFood {};
class varHandle {};
class varToStr {};
class impoundPrice {};
class itemWeight {};
class taxRate {};
class virt_shops {};
class vehShopLicenses {};
class vehicleAnimate {};
class weaponShopCfg {};
class vehicleWeightCfg {};
class houseConfig {};
class craftCfg {};
//Clothing Store Configs
class clothing_cop {};
class clothing_bruce {};
class clothing_reb {};
class clothing_dive {};
class clothing_medic {};
class clothing_donator {};
class clothing_admin {};
class clothing_kart {};
class clothing_schwarzmarkt {};
class clothing_gun {};
};
Und die Shops:
Spoiler anzeigen
class Shops
{
file = "core\shops";
class atmMenu {};
class buyClothes {};
class changeClothes {};
class clothingMenu {};
class clothingFilter {};
class vehicleShopMenu {};
class vehicleShopLBChange {};
class vehicleShopBuy {};
class weaponShopFilter {};
class weaponShopMenu {};
class weaponShopSelection {};
class weaponShopBuySell {};
class virt_buy {};
class virt_menu {};
class virt_sell {};
class virt_update {};
class chopShopMenu {};
class chopShopSelection {};
class chopShopSell {};
class licenses {};
};
Habe ich etwas vergessen? Ist etwas falsch? Wie kann ich das beheben?
Mfg
Timo Goeres