Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
ClowDes

Команда в условии.

Здравствуйте, делаю условие на выполнение кода в случаях если у игрока имеется любое оружие в инвентаре. PrimaryWeapon со своей задачей справляется не до конца. Игнорирует полностью пистолеты. На вики от Богемии увидел SecondaryWeapon и сразу подумал, что это те самые пистолеты :), а на деле рюкзаки/ракетницы и т.п. Нашёл команду HandgunWeapon, но она для Армы 3 -_-. Ну и как мне в условие вписать пистолеты? Через команду hasWeapon всё работает, но блин, вписывать ID каждого предмета это как-то не красиво, да и условие получается длинющееее. Может кто знает, как по людски вписать в условие проверку пистолетов без команды hasWeapon?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
getPistol = {
	/**
		Описание:
		Ищет пистолета в инвентаре игрока.
		
		Возвращает:
		String (наименование пистолета, если он есть в инвентаре, или пустую строку, если нет).
		
		Использование:
		_pistol = call getPistol;
    */

	private "_pistol";
	_pistol = "";
	{ if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith { _pistol = _x }; } forEach weapons player;
	_pistol
};

 

Share this post


Link to post
Share on other sites



  • 0
2 часа назад, ClowDes сказал:

любое оружие в инвентаре

Private ["_weapons", "_config", "_configName", "_wepType", "_toolBelt", "_Binocular", "_Pistols", "_Rifles"];
_weapons	=	(weapons player);
_toolBelt	=	0;
_Binocular	=	0;
_Pistols	=	0;
_Rifles		=	0;
{
	_config		=	(configFile >> "CfgWeapons" >> _x);
	_configName	=	configName(_config);
	_wepType	=	getNumber(_config >> "Type");
	switch (_wepType) do
		{
			case 131072	:	{_toolBelt	=	_toolBelt + 1;};
			case 4096	:	{_Binocular	=	_Binocular + 1;};
			case 2		:	{_Pistols	=	_Pistols + 1;};
			case 1		:	{_Rifles	=	_Rifles + 1;};
		};	
} forEach _weapons;
diag_log(format["Предметов на поясе: %1, биноклей: %2, пистолетов: %3, винтовок: %4", _toolBelt, _Binocular, _Pistols, _Rifles]);

Благодарности на яндекс))): 410011293864225

Share this post


Link to post
Share on other sites
  • 0

Дяденьки Вы просто жёсткие, что один, что другой. Всё работает, благодарочка. Просто круть, просто нет слов.

Edited by ClowDes (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.