Jump to content
HallyG

[RELEASE] HALs Equipment Store v1.1

Recommended Posts

HALs Store v1.1

Xj0dWjl.png

 

 

This was the first GUI project that I began and finished a few years ago before it was lost deep in the mists of my hard drive. I have recently re-discovered it and thought I'd make it look prettier (I mean just look at this less charming earlier version) as well as completely rewriting it before its release.

 

If you have any suggestions, feedback or constructive criticism, feel free to leave a comment!
 

Videos (v1.0):

Spoiler

 

 

 

Purpose of this script:

Adds an Equipment (buy menu) dialog in to any mission such that players can buy equipment, using an in-game currency system, defined by the mission maker.

 

Features:

  • Easily configurable Store; define your own traders and categories in your description.ext.
  • Each Trader can have its own (defined by the mission maker) categories (eg: Handguns, Magazines, Backpacks) each with their own items.
  • Items have their own prices (defined by the mission maker); if the player does not have enough money for an item, the item cannot be purchased.
  • Items have their own stock (defined by the mission maker); if there is no stock for an item, the item cannot be purchased.
  • Items have their own descriptions (taken from the ingame config files) but can have their own custom description which supports structured text.
  • Purchase items to nearby vehicles or even to the player's backpack, uniform and vest.
  • Helpful dialog which indicates the current load of a container in addition to how much space the selected item will occupy in that container.
  • The dialog utilises checkboxes (default: all deselected) which allow the user to filter items with preset conditions (affordable, in stock, compatible with equipped weapons).
  • The dialog utilises progress bars to show the user the stats of the currently selected backpack/optic/uniform/vest or weapon.
    • Weapons include: Accuracy, Impact, Rate of Fire and Range.
    • Equipment stats include: Ballistic Protection, Explosion Resistance and Maximum load.
    • Optics stats include: Zoom.

 

Installation && Usage && Useful functions:

Installation

Usage and useful Functions

 

Configuration:

Configuration

Configuration Example

 

Important Information:

  • Items defined in cfgHALsStore MUST have the same classname as the item's classname in cfgWeapons or cfgVehicles.
  • The trader's addAction will only show if the player is on foot and within 5 meters of the trader.
  • Vehicles can have items purchased to them if they are of a certain type (defined by the mission maker) and within a certain distance (defined by the mission maker) of the trader.

 

 

EXAMPLE MISSION DOWNLOAD (v1.1)

ARMAHOLIC DOWNLOAD (v1.1)

Thanks to:

  • All the members of the community who dedicate their time to document the wiki, post snippets and answers questions on the forums.
  • 7erra for the German translation.

 

Known issues:

  • I haven't tested it on a dedicated server, yet, but I'll get around to it when my schedule opens up.

 

Changelog:

 

 

Cheers

 

  • Like 10

Share this post


Link to post
Share on other sites

Really great dialog! I took a look at the stringtable.xml and added a German translation:

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<Project name="HALs_store">
    <Package name="General">
	    <Key ID="STR_HALS_STORE_ACTION">
		    <Original>Store</Original>
		    <English>Store</English>
		    <French></French>
			<German>Geschäft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_UNAVALIABLE">
		    <Original>Item unavaliable</Original>
		    <English>Item unavaliable</English>
		    <French></French>
			<German>Gegenstand nicht verfügbar</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_OUTOFSTOCK">
		    <Original>Insufficient stock</Original>
		    <English>Insufficient stock</English>
		    <French></French>
			<German>Ausverkauft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_TOOEXPENSIVE">
		    <Original>Insufficient funds</Original>
		    <English>Zu wenig Geld</English>
		    <French></French>
			<German></German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_NOCARGOSPACE">
		    <Original>Insufficient cargo space</Original>
		    <English>Insufficient cargo space</English>
		    <French></French>
			<German>Nicht genug Platz</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_PURCHASED">
		    <Original>purchased</Original>
		    <English>purchased</English>
		    <French></French>
			<German>gekauft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	</Package>
	<Package name="Dialog">
	    <Key ID="STR_HALS_STORE_CHECKBOX_AFFORD">
		    <Original>Only show items which the player can afford</Original>
		    <English>Only show items which the player can afford</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die sich der Spieler leisten kann</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_STOCK">
		    <Original>Only show items which are in stock</Original>
		    <English>Only show items which are in stock</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die auf Lager sind</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_COMPATIBLE">
		    <Original>Only show items compatible with the player's equipped weapons</Original>
		    <English>Only show items compatible with the player's equipped weapons</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die mit der ausgerüsteten Waffe des Spielers kompatibel sind</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_EQUIP">
		    <Original>Equip item upon purchase (if possible)</Original>
		    <English>Equip item upon purchase (if possible)</English>
		    <French></French>
			<German>Gegenstand beim Kauf ausrüsten (wenn möglich)</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_BUTTON_PURCHASE">
		    <Original>Purchase</Original>
		    <English>Purchase</English>
		    <French></French>
			<German>Kaufen</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_PRICE">
		    <Original>Price</Original>
		    <English>Price</English>
		    <French></French>
			<German>Preis</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_INSTOCK">
		    <Original>IN STOCK</Original>
		    <English>IN STOCK</English>
		    <French></French>
			<German>AUF LAGER</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_NOSTOCK">
		    <Original>OUT OF STOCK</Original>
		    <English>OUT OF STOCK</English>
		    <French></French>
			<German>AUSVERKAUFT</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_LISTBOX_NOMONEY">
		    <Original>%1¢ more required</Original>
		    <English>%1¢ more required</English>
		    <French></French>
			<German>%1¢ mehr benötigt</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	</Package>
</Project>

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Okay, I confirm that 7erra's translations are well-worded... ;-)

 

 

@7erralittle mistake:

Spoiler

 

 


<Key ID="STR_HALS_STORE_ITEM_TOOEXPENSIVE">
		    <Original>Insufficient funds</Original>
		    <English>Zu wenig Geld</English>
		    <French></French>
			<German></German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>

 

 

  • Like 1

Share this post


Link to post
Share on other sites

 

On 26/07/2017 at 1:06 PM, 7erra said:

Really great dialog! I took a look at the stringtable.xml and added a German translation:

  Reveal hidden contents


<?xml version="1.0" encoding="UTF-8"?>
<Project name="HALs_store">
    <Package name="General">
	    <Key ID="STR_HALS_STORE_ACTION">
		    <Original>Store</Original>
		    <English>Store</English>
		    <French></French>
			<German>Geschäft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_UNAVALIABLE">
		    <Original>Item unavaliable</Original>
		    <English>Item unavaliable</English>
		    <French></French>
			<German>Gegenstand nicht verfügbar</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_OUTOFSTOCK">
		    <Original>Insufficient stock</Original>
		    <English>Insufficient stock</English>
		    <French></French>
			<German>Ausverkauft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_TOOEXPENSIVE">
		    <Original>Insufficient funds</Original>
		    <English>Zu wenig Geld</English>
		    <French></French>
			<German></German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_NOCARGOSPACE">
		    <Original>Insufficient cargo space</Original>
		    <English>Insufficient cargo space</English>
		    <French></French>
			<German>Nicht genug Platz</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_ITEM_PURCHASED">
		    <Original>purchased</Original>
		    <English>purchased</English>
		    <French></French>
			<German>gekauft</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	</Package>
	<Package name="Dialog">
	    <Key ID="STR_HALS_STORE_CHECKBOX_AFFORD">
		    <Original>Only show items which the player can afford</Original>
		    <English>Only show items which the player can afford</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die sich der Spieler leisten kann</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_STOCK">
		    <Original>Only show items which are in stock</Original>
		    <English>Only show items which are in stock</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die auf Lager sind</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_COMPATIBLE">
		    <Original>Only show items compatible with the player's equipped weapons</Original>
		    <English>Only show items compatible with the player's equipped weapons</English>
		    <French></French>
			<German>Zeige nur Gegenstände, die mit der ausgerüsteten Waffe des Spielers kompatibel sind</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_CHECKBOX_EQUIP">
		    <Original>Equip item upon purchase (if possible)</Original>
		    <English>Equip item upon purchase (if possible)</English>
		    <French></French>
			<German>Gegenstand beim Kauf ausrüsten (wenn möglich)</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	    <Key ID="STR_HALS_STORE_BUTTON_PURCHASE">
		    <Original>Purchase</Original>
		    <English>Purchase</English>
		    <French></French>
			<German>Kaufen</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_PRICE">
		    <Original>Price</Original>
		    <English>Price</English>
		    <French></French>
			<German>Preis</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_INSTOCK">
		    <Original>IN STOCK</Original>
		    <English>IN STOCK</English>
		    <French></French>
			<German>AUF LAGER</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_TEXT_NOSTOCK">
		    <Original>OUT OF STOCK</Original>
		    <English>OUT OF STOCK</English>
		    <French></French>
			<German>AUSVERKAUFT</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
		<Key ID="STR_HALS_STORE_LISTBOX_NOMONEY">
		    <Original>%1¢ more required</Original>
		    <English>%1¢ more required</English>
		    <French></French>
			<German>%1¢ mehr benötigt</German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>
	</Package>
</Project>

 

 

7erra, thank you for your feedback and the translations. I'll update the github.

 

On 26/07/2017 at 2:07 PM, sarogahtyp said:

Okay, I confirm that 7erra's translations are well-worded... ;-)

  Reveal hidden contents

 

 



<Key ID="STR_HALS_STORE_ITEM_TOOEXPENSIVE">
		    <Original>Insufficient funds</Original>
		    <English>Zu wenig Geld</English>
		    <French></French>
			<German></German>
			<Russian></Russian>
			<Spanish></Spanish>
			<Italian></Italian>
		</Key>

 

 

Heh, nice find. Nothing like some accidental language lessons when you are buying firearms..

 

  • Like 1

Share this post


Link to post
Share on other sites

Have't tried this yet but it looks great!

I already have a mission that could use this however would it be possible to add the ability for the player to sell the Items that can also be bought?

Would be nice if you could add that as I really need a sell-system but am not able to create one myself.

 

Anyway, keep up the good work!

  • Like 1

Share this post


Link to post
Share on other sites

I believe it would make sense to also display some stats, similar to the Arsenal.

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, bf2freak1997 said:

I already have a mission that could use this however would it be possible to add the ability for the player to sell the Items that can also be bought?

Would be nice if you could add that as I really need a sell-system but am not able to create one myself.

Thanks for your feedback. This is a feature that I want to (and probably will no doubt) add but will require some prior planning since it might require a change in the GUI. 
 

 

8 hours ago, R3vo said:

I believe it would make sense to also display some stats, similar to the Arsenal.

Thanks for your suggestion, I am already adding it now.

 

I'll push an official update later this week but in the mean time the GitHub will be updated with the bug fixes, translations and some other misc. additions (and probably the new stats bars later but those will be added later today/tomorrow).

Share this post


Link to post
Share on other sites

Cool, thanks for your reply! Looking forward to it.

 

I also love the Idea with the stats, looking forward for that as well!

Share this post


Link to post
Share on other sites

Love the new relase, however it would be nice to have documentation or at least an example in the mission on how to add custom descriptions (maybe I'm just too stupid, not sure).

And I also think there's a bug with the "show only Items that are compatible..."-option.

Whenever I have a Weapon equipped and select that option no Items are being displayed anymore (except for magazines) even though scopes, muzzle items, etc. are compatible with my weapon (MX and Protector in my case).

Share this post


Link to post
Share on other sites
2 hours ago, bf2freak1997 said:

Love the new relase, however it would be nice to have documentation or at least an example in the mission on how to add custom descriptions (maybe I'm just too stupid, not sure).

And I also think there's a bug with the "show only Items that are compatible..."-option.

Whenever I have a Weapon equipped and select that option no Items are being displayed anymore (except for magazines) even though scopes, muzzle items, etc. are compatible with my weapon (MX and Protector in my case).

I forgot to upload the new description.ext but I think I updated the example configuration page (should be near the top of the github page) if you want to take a look.

I'll take a look now. I haven't updated any of the example missions (just fyi) but I'll post a pre-release version with a demonstration of all the new features.

Share this post


Link to post
Share on other sites

Firstly, thanks for your reply!

Secondly: Yep there's something on the configuration page. Haven't seen that - sorry.

Also, what's up next if I may ask?

Share this post


Link to post
Share on other sites

Looks really good. Gonna try it now and see how it goes

Share this post


Link to post
Share on other sites

HALs Equipment Store v1.1

 

Xj0dWjl.png

 

Download:

  • Updated links in the first post.

Changelog:
The full changelog can be found HERE.

  • Fixed various bugs.
  • Added German Translation thanks to 7erra (currently missing one translation but only because I added it in v1.1).
  • Added, traders can now be any object which has the type CAManBase, Car_F or ReammoBox_F.
  • Added: items can now have custom descriptions which support structured text.
  • Added: item stats bars (thanks to R3vo for the suggestion) Thank goodness for  BIS arsenal because I was being a complete idiot when attempting to extract maximum values..
  • Like 2

Share this post


Link to post
Share on other sites
<KEY ID="STR_HALS_STORE_ITEM_NOEQUIP">
    <Original>Unable to equip</Original>
    <English>Unable to equip</English>
    <French></French>
    <German>Ausrüsten fehlgeschlagen</German>
    <Russian></Russian>
    <Spanish></Spanish>
    <Italian></Italian>
  </Key>

If you want to know a translation beforehand I'll keep an eye on my PNs, just saying ;)

  • Like 1

Share this post


Link to post
Share on other sites

Hi, it's possible an option to display the current money on screen permanently?!

 

 

Share this post


Link to post
Share on other sites
54 minutes ago, Kain181 said:

Hi, it's possible an option to display the current money on screen permanently?!

Thank you for the suggestion, I haven't really considered adding an option but maybe I should give it a rethink. Meanwhile, this is what you can use to display money on the screen, permanently. 


Add this to your initPlayerLocal.sqf

Spoiler

[] spawn {
	if (isNil "HALs_money_updateDelay") then {
		waitUntil {!(isNull findDisplay 46)};
		disableSerialization;
		
		_control = (findDisplay 46) ctrlCreate ["RscStructuredText", 19998];
		_control ctrlSetTextColor [0.67,1,0.67,1];
		_control ctrlSetFont "PuristaLight";
		_width = (15/108) * safeZoneH;
		_control ctrlSetPosition [safeZoneX + safeZoneW - _width, safeZoneY + safeZoneH - ((13/108) * safeZoneH), _width, (4/108) * safeZoneH];
		_control ctrlCommit 0;

		HALs_money_updateDelay = 0.15;
		HALs_money_nextUpdate = diag_tickTime;
		HALs_money_previousBalance = -1;

		addMissionEventHandler ["EachFrame", {
			if (diag_tickTime > HALs_money_nextUpdate) then {
				_money = [player] call HALs_money_fnc_getFunds;

				if !(_money isEqualTo HALs_money_previousBalance) then {
					HALs_money_previousBalance = _money;
					_control = (findDisplay 46) displayCtrl 19998;
					_control ctrlSetStructuredText parseText format ["<t size='1.7' shadow='2' align='right'>%1¢</t>", _money];
				};

				HALs_money_nextUpdate = diag_tickTime + HALs_money_updateDelay;
			};
		}];
	};
};

 


 

  • Like 1

Share this post


Link to post
Share on other sites

Thank you so much!!!

 

So, now i've a doubt about the actual state of your project ...

it'spossible to define another object instead of CargoNet as a trader already,   e.g: footlockers, crates, boxes ..?!

Share this post


Link to post
Share on other sites

Why there isn't any information about the command "lbSetTextRight"  on the wiki ?

Share this post


Link to post
Share on other sites

There are several commands with no documentation on the wiki. Some of them aren't used and others are not important because they arent used on a regular basis. The syntax for the lbSetTextRight command is this:

_listbox lbSetTextRight [_index,"Some text"];

// Seems not to work:
// lbSetTextRight [_idc, _index, "Text"];
// even though it is the nomal syntax for the other LB commands

And it will look like this:

IVjI4Fa.png

_listbox = (findDisplay 9999) displayCtrl 1500;
for "_i" from 0 to 10 do {
	_index = _listbox lbAdd ("Left: " +str _i);
	_lbConversation lbSetTextRight [_index,"Right: " +str _index];
};

 

  • Like 1

Share this post


Link to post
Share on other sites
On 08/08/2017 at 4:05 PM, Kain181 said:

Thank you so much!!!

 

So, now i've a doubt about the actual state of your project ...

it'spossible to define another object instead of CargoNet as a trader already,   e.g: footlockers, crates, boxes ..?!


Firstly, sorry for the delayed reply, I have been away.

Secondly, cars, ammoboxes and CAManBase type objects should be allowed as traders (as of version 1.1).

 

Currently, I don't think footlockers are supported but I can easily change that. I will check that this is functioning correctly later on today.

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Hello,HallyG

 

The HAL‘s store is very good! 

 I want to convert HAL's_money into a custom money system, such as the Ravage money system. How can I change it? I know there are a few variables like _price, _money should have more. . . . But the HAL's_money script is too complicated. I analyzed it for a long time and couldn’t figure it out.   

 

Here is the Ravage store buy script  

 

params ["_classname", "_price", "_cfg"];
_trader = player getVariable ["isTradingWith", nil];
_shopType = missionNameSpace getVariable (_trader getVariable "isTrader");
_text = getText (configFile >> _cfg >> _classname >> "displayName");

_money = {_x isEqualTo "rvg_money"} count magazines player;
if (_money < _price) exitWith {hint "Not enough money!"};
if (!(player canAdd [_classname, 1])) exitWith {hint "Your inventory is full already."};
if (_classname in (weapons _trader)) then {
    _trader removeWeaponGlobal _classname;
} else {
    _trader removeItem _classname;
};
for "_prout" from 1 to _price do {player removeItem "rvg_money"};
player addItem _classname;
hint format ["You bought one %1 for %2$.", _text, _price];
cameraOn say3d selectRandom ["bank1", "bank2", "bank3"];

 

 

I know that HALs_store is a virtual currency system and Ravage's currency has actual items, and the amount of money is defined according to the number of items. So how can I change it?

 

 

Share this post


Link to post
Share on other sites
19 hours ago, 199918hao said:

 

 

Hi, you could change the functions HALs_money_fnc_addFunds and HALs_money_fnc_getFunds without having to alter the functionality of the store script itself.

 

I would provide some code for you to try but I am unable to test anything because my computer is completely broken.

 

Cheers,

Hal

Share this post


Link to post
Share on other sites
2 hours ago, HallyG said:

 

Hi, you could change the functions HALs_money_fnc_addFunds and HALs_money_fnc_getFunds without having to alter the functionality of the store script itself.

 

I would provide some code for you to try but I am unable to test anything because my computer is completely broken.

 

Cheers,

Hal

Unfortunately, your computer is broken.:dozingoff:You can also help me solve the problem here.

So how do I change HALs_money_fnc_addFunds and HALs_money_fnc_getFunds functions?  

I know that ravage has a statement:“_money = {_x isEqualTo "rvg_money"} count magazines player;”  Means to check the number of rvg_money item in the equipment .

“for "_prout" from 1 to _price do {player removeItem "rvg_money"};”  This is the statement to remove rvg_money item after buying something.The knowledge of my script is not enough, so I can only know the meaning of these two sentences.So how can I change it?

 

The following is the Ravage trading script, you can analyze.

 

Ravage‘s sell.sqf

params ["_classname", "_price", "_cfg"];
_trader = player getVariable ["isTradingWith", nil];
_shopType = missionNameSpace getVariable (_trader getVariable "isTrader");
_text = getText (configFile >> _cfg >> _classname >> "displayName");

if (_classname in magazines player) then {
    player removeMagazine _classname;
} else {
    /*if (_classname in (items backpackContainer player)) then {
        player removeItemFromBackpack _classname;
    } else {
        if (_classname in (items vestContainer player)) then {
            player removeItemFromVest _classname;
        } else {
            if (_classname in (items uniformContainer player)) then {
                player removeItemFromUniform _classname;
            } else {
                if (_classname in weapons player) then {
                    player removeWeaponGlobal _classname;
                } else {
                    player removeItem _classname;
                };
            };
        };
    };*/
    if (_classname in (backpackItems player)) then {
        player removeItemFromBackpack _classname;
    } else {
        if (_classname in (vestItems player)) then {
            player removeItemFromVest _classname;
        } else {
            if (_classname in (uniformItems player)) then {
                player removeItemFromUniform _classname;
            } else {
                if (_classname in weapons player) then {
                    player removeWeaponGlobal _classname;
                } else {
                    player removeItem _classname;
                };
            };
        };
    };
};
for "_prout" from 1 to _price do {player addItem "rvg_money"};
if (_trader canAdd [_classname, 1]) then {
    _trader addItem _classname;
};
hint format ["You sold one %1 for %2$.", _text, _price];
cameraOn say3d selectRandom ["bank1", "bank2", "bank3"];

 

Ravage‘s buy.sqf

 

params ["_classname", "_price", "_cfg"];
_trader = player getVariable ["isTradingWith", nil];
_shopType = missionNameSpace getVariable (_trader getVariable "isTrader");
_text = getText (configFile >> _cfg >> _classname >> "displayName");

_money = {_x isEqualTo "rvg_money"} count magazines player;
if (_money < _price) exitWith {hint "Not enough money!"};
if (!(player canAdd [_classname, 1])) exitWith {hint "Your inventory is full already."};
if (_classname in (weapons _trader)) then {
    _trader removeWeaponGlobal _classname;
} else {
    _trader removeItem _classname;
};
for "_prout" from 1 to _price do {player removeItem "rvg_money"};
player addItem _classname;
hint format ["You bought one %1 for %2$.", _text, _price];
cameraOn say3d selectRandom ["bank1", "bank2", "bank3"];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×