mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
added player helper functions
This commit is contained in:
26
SQF/dayz_code/compile/fn_hasTools.sqf
Normal file
26
SQF/dayz_code/compile/fn_hasTools.sqf
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Description:
|
||||
Checks whether the player has the required tools equipped or not
|
||||
and displays a message if a tool is missing from the tool belt.
|
||||
|
||||
Parameter(s):
|
||||
_this: <array> list of tool names the player is required to have
|
||||
|
||||
Returns:
|
||||
Boolean (true if the player has all required tools)
|
||||
|
||||
How to use:
|
||||
_hasTools = ["ItemToolbox", "ItemCrowbar"] call player_hasTools;
|
||||
*/
|
||||
private ["_tools","_items","_hasTools","_missing"];
|
||||
_tools = _this;
|
||||
_items = items player; // weapons player
|
||||
_hasTools = true;
|
||||
{
|
||||
if (!(_x in _items)) exitWith {
|
||||
_hasTools = false;
|
||||
_missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
|
||||
cutText [format["Missing tool %1", _missing] , "PLAIN DOWN"];
|
||||
};
|
||||
} forEach _tools;
|
||||
_hasTools
|
||||
Reference in New Issue
Block a user