Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cScripts and loadout chat command to give you cscripts version and loadout name #1211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class cScripts {
// other
class gear_getLoadoutRole {};
class gear_getLoadoutName {};
class gear_getLoadoutDisplayName {};
};
class diag {
file = "cScripts\functions\diag";
Expand Down
30 changes: 30 additions & 0 deletions cScripts/functions/gear/fn_gear_getLoadoutDisplayName.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "..\script_component.hpp"
/*
* Author: CPL.Brostrom.A
* This function return a units current loadouts displayname.
*
* Arguments:
* 0: Unit <Object>
*
* Return Value:
* Loadout name <STRING>
*
* Example:
* [player] call cScripts_fnc_gear_getLoadoutDisplayName;
* [cursorObject] call cScripts_fnc_gear_getLoadoutDisplayName;
*
*/

params [["_unit", objNull, [objNull]]];

private _loadout = [_unit] call EFUNC(gear,getLoadoutName);

private _missionConfig = missionConfigFile >> "CfgLoadouts" >> _loadout;
private _displayName = getText (_missionConfig >> "displayName");

if (_displayName == "") then {
private _config = configFile >> "CfgLoadouts" >> _loadout;
_displayName = getText (_config >> "displayName");
};

_displayName
11 changes: 11 additions & 0 deletions cScripts/functions/init/fn_init_chatCommands.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@
["attendance", {
[QGVAR(getAttendance)] call CBA_fnc_localEvent;
}, "all"] call CBA_fnc_registerChatCommand;

// Help and diagnostic commands
["cScripts", {
systemChat format["cScripts version: %1", VERSION];
}, "all"] call CBA_fnc_registerChatCommand;

["loadout", {
private _name = [player] call EFUNC(gear,getLoadoutDisplayName);
private _loadout = [player] call EFUNC(gear,getLoadoutName);
systemChat format["Your current loadout is: %1 [%2]",_name,_loadout];
}, "all"] call CBA_fnc_registerChatCommand;