Hallo alle zusammen.
Ich hab jetzt lange nach einer Möglichkeit gesucht einen Button einzubauen mit dem man am Händler (z.B. Drogendealer) alles auf einmal verkaufen kann.
Da ich fast nichts gefunden hab gebe ich euch allen hier ein Tutorial um euch die Arbeit des suchens zu ersparen.
Original Thema hier zu finden:
https://www.altisliferpg.com/topic/2158-tut…ell-all-button/
Author: Basti | John Collins
Author Contact: [email protected]
Schritt 1
Geht in core/shops/ und erstellt dort die Datei: fn_virt_sellAll.sqf
und fügt dort folgendes ein:
#include "..\..\script_macros.hpp"
/*
File: fn_virt_sell.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sell a virtual item to the store / shop
*/
private ["_type","_index","_price","_amount","_name"];
if ((lbCurSel 2402) isEqualTo -1) exitWith {};
_type = lbData[2402,(lbCurSel 2402)];
_price = M_CONFIG(getNumber,"VirtualItems",_type,"sellPrice");
if (_price isEqualTo -1) exitWith {};
_amount = ITEM_VALUE(_type);
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
life_action_delay = time;
_price = (_price * _amount);
_name = M_CONFIG(getText,"VirtualItems",_type,"displayName");
if ([false,_type,_amount] call life_fnc_handleInv) then {
hint format [localize "STR_Shop_Virt_SellItem",_amount,(localize _name),[_price] call life_fnc_numberText];
CASH = CASH + _price;
[0] call SOCK_fnc_updatePartial;
[] call life_fnc_virt_update;
};
if (life_shop_type isEqualTo "drugdealer") then {
private ["_array","_ind","_val"];
_array = life_shop_npc getVariable ["sellers",[]];
_ind = [getPlayerUID player,_array] call TON_fnc_index;
if (!(_ind isEqualTo -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 pushBack [getPlayerUID player,profileName,_price];
life_shop_npc setVariable ["sellers",_array,true];
};
};
if (life_shop_type isEqualTo "gold" && (LIFE_SETTINGS(getNumber,"noatm_timer")) > 0) then {
[] spawn {
life_use_atm = false;
sleep ((LIFE_SETTINGS(getNumber,"noatm_timer")) * 60);
life_use_atm = true;
};
};
[3] call SOCK_fnc_updatePartial;
Alles anzeigen
Schritt 2
Öffnet eure functions.hpp im Hauptverzeichnis und fügt unter "class Shops" folgendes ein:
sollte dann so aussehen:
class Shops {
file = "core\shops";
class atmMenu {};
class buyClothes {};
class changeClothes {};
class chopShopMenu {};
class chopShopSelection {};
class chopShopSell {};
class clothingFilter {};
class clothingMenu {};
class fuelLBchange {};
class fuelStatOpen {};
class levelCheck {};
class vehicleShop3DPreview {};
class vehicleShopBuy {};
class vehicleShopEnd3DPreview {};
class vehicleShopInit3DPreview {};
class vehicleShopLBChange {};
class vehicleShopMenu {};
class virt_buy {};
class virt_menu {};
class virt_sellAll {};
class virt_sell {};
class virt_update {};
class weaponShopAccs {};
class weaponShopBuySell {};
class weaponShopFilter {};
class weaponShopMags {};
class weaponShopMenu {};
class weaponShopSelection {};
};
Alles anzeigen
Schritt 3
Geht in die Datei dialog/shop_items.hpp und fügt ganz unten den Button hinzu:
class ButtonRemoveAllG: Life_RscButtonMenu
{
idc = 17999;
text = "Sell. All";
onButtonClick = "[] call Life_fnc_virt_sellAll;";
x = 0.592716 * safezoneW + safezoneX;
y = 0.71 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.033 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
ColorText[] = {1,1,1,1};
};
Alles anzeigen
Sollte dann so aussehen:
////////////////////////////////////////////////////////////////////////////
////// This HPP was created by Shinji`s GUI tool //////
////////////////////////////////////////////////////////////////////////////
class shops_menu {
idd = 2400;
name = "shops_menu";
onLoad = "";
onUnLoad = "";
movingEnable = false;
enableSimulation = false;
class controlsBackground {
class Life_RscTitleBackground: Life_RscText
{
idc = -1;
text = "";
x = 0.1 * safezoneW + safezoneX;
y = 0.2 * safezoneH + safezoneY;
w = 0.8 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.698039};
};
class MainBackground: Life_RscText
{
idc = 2999;
text = "";
x = 0.1 * safezoneW + safezoneX;
y = 0.244 * safezoneH + safezoneY;
w = 0.8 * safezoneW;
h = 0.512 * safezoneH;
ColorBackground[] = {0,0,0,0.698039};
};
class vasText: Life_RscText
{
idc = 5999;
text = "$STR_VS_SI";
x = 0.12 * safezoneW + safezoneX;
y = 0.27 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
};
};
class controls {
class vasgText: Life_RscText
{
idc = 8999;
text = "$STR_VS_PI";
x = 0.53 * safezoneW + safezoneX;
y = 0.27 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
ColorText[] = {1,1,1,1};
};
class itemList: Life_RscListBox
{
idc = 2401;
text = "";
x = 0.12 * safezoneW + safezoneX;
y = 0.31 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.34 * safezoneH;
ColorBackground[] = {0.098039,0.098039,0.098039,0.588235};
ColorText[] = {1,1,1,1};
};
class pItemlist: Life_RscListBox
{
idc = 2402;
text = "";
x = 0.53 * safezoneW + safezoneX;
y = 0.31 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.34 * safezoneH;
ColorBackground[] = {0.098039,0.098039,0.098039,0.588235};
ColorText[] = {1,1,1,1};
};
class Title: Life_RscText
{
idc = 2403;
text = "";
x = 0.1 * safezoneW + safezoneX;
y = 0.2 * safezoneH + safezoneY;
w = 0.8 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0,0,0,0};
ColorText[] = {1,1,1,1};
};
class PlayersName: Life_RscText
{
idc = 601;
text = "";
x = 0.1 * safezoneW + safezoneX;
y = 0.2 * safezoneH + safezoneY;
w = 0.8 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.098039,0.098039,0.098039,0};
ColorText[] = {1,1,1,1};
};
class buyEdit: Life_RscEdit
{
idc = 2404;
text = "1";
x = 0.12 * safezoneW + safezoneX;
y = 0.66 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.03 * safezoneH;
ColorBackground[] = {0.784313,0.784313,0.784313,0};
ColorText[] = {1,1,1,1};
};
class sellEdit: Life_RscEdit
{
idc = 2405;
text = "1";
x = 0.53 * safezoneW + safezoneX;
y = 0.66 * safezoneH + safezoneY;
w = 0.35 * safezoneW;
h = 0.03 * safezoneH;
ColorBackground[] = {0.784313,0.784313,0.784313,0};
ColorText[] = {1,1,1,1};
};
class ButtonAddG: Life_RscButtonMenu
{
idc = 11999;
text = "$STR_VS_BuyItem";
onButtonClick = "[] spawn life_fnc_virt_buy;";
x = 0.216875 * safezoneW + safezoneX;
y = 0.7 * safezoneH + safezoneY;
w = 0.15625 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
ColorText[] = {1,1,1,1};
};
class ButtonRemoveG: Life_RscButtonMenu
{
idc = 14999;
text = "$STR_VS_SellItem";
onButtonClick = "[] call life_fnc_virt_sell";
x = 0.704548 * safezoneW + safezoneX;
y = 0.706789 * safezoneH + safezoneY;
w = 0.15625 * safezoneW;
h = 0.04 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
ColorText[] = {1,1,1,1};
};
class ButtonRemoveAllG: Life_RscButtonMenu
{
idc = 17999;
text = "Sell. All";
onButtonClick = "[] call Life_fnc_virt_sellAll;";
x = 0.592716 * safezoneW + safezoneX;
y = 0.71 * safezoneH + safezoneY;
w = 0.103125 * safezoneW;
h = 0.033 * safezoneH;
ColorBackground[] = {0.380392,0.698039,0.882352,0.498039};
ColorText[] = {1,1,1,1};
};
};
};
////////////////////////////////////////////////////////////////////////////
Alles anzeigen
Fertig
Sollte bei allen Händlern und Märkten funktionieren. Ich selbst benutze Version 5.0 sollte aber auch für 4.4R3 und 4.4R4 funktionieren.
Viel Spaß damit.