-
Notifications
You must be signed in to change notification settings - Fork 10
Functions
Function
HG_fnc_setRank
Parameters
0 - OBJECT - Unit you want the rank to be set on
1 - STRING - Rank you want to set [default: "PRIVATE"]
Returns
Nothing
Case #1 - Local execution (e.g using addAction in init box on editor placed object)
[player,"COLONEL"] call HG_fnc_setRank; // Sets COLONEL rank on you
Case #2 - Remote execution
_unit refers to a player object
["COLONEL"] remoteExecCall ["HG_fnc_setRank",_unit,false]; // _unit is now COLONEL
If you have a system in your mission that allows players to find vehicles on map and claim ownership, you can use this function:
Function
HG_fnc_setOwner
Parameters
0 - OBJECT - Vehicle
1 - OBJECT - New owner [default: player unit]
Returns
Nothing
Case #1 - Local execution (e.g using addAction in init box on editor placed vehicle)
this addAction["Claim this vehicle",{[(_this select 0)] call HG_fnc_setOwner},"",0,false,false,"",'(alive player) && !dialog && player distance _target < 3'];
Case #2 - Remote execution
_vehicle refers to the vehicle you want to give ownership of to _unit
_unit refers to the new vehicle owner
[_vehicle,_unit] remoteExecCall ["HG_fnc_setOwner",_unit,false]; // _unit is now the new owner of _vehicle
Case #3 - addAction remotely executed, available to everyone (useful for dynamically spawned vehicles during mission)
_vehicle is the dynamically spawned vehicle in your script
[_vehicle,["Claim this vehicle",{[(_this select 0)] call HG_fnc_setOwner},"",0,false,false,"",'(alive player) && !dialog && player distance _target < 3']] remoteExec ["addAction",-2,true];
Function
HG_fnc_addOrSubCash
Parameters
0 - INTEGER - Amount of cash [default: 1]
1 - INTEGER - 0 means add, 1 means subtract [default: 0]
2 - INTEGER - 0 means add/take in/from pockets, 1 means add/take in/from bank [default: 0]
Returns
Nothing
Case #1 - Local execution
[500,0] call HG_fnc_addOrSubCash; // Adds 500 to cash
[500,1] call HG_fnc_addOrSubCash; // Subs 500 from cash
[500,0,1] call HG_fnc_addOrSubCash; // Adds 500 to bank
[500,1,1] call HG_fnc_addOrSubCash; // Subs 500 from bank
Case #2 - Remote execution
_unit refers to a player
[500,0] remoteExecCall ["HG_fnc_addOrSubCash",_unit,false]; // Adds 500 to cash
[500,1] remoteExecCall ["HG_fnc_addOrSubCash",_unit,false]; // Subs 500 from cash
[500,0,1] remoteExecCall ["HG_fnc_addOrSubCash",_unit,false]; // Adds 500 to bank
[500,1,1] remoteExecCall ["HG_fnc_addOrSubCash",_unit,false]; // Subs 500 from bank
Has to be enabled in config first see enableXP
Function
HG_fnc_addOrSubXP
Parameters
0 - INTEGER - Amount of XP [default: 1]
1 - INTEGER - 0 means add, 1 means subtract [default: 0]
Returns
Nothing
Case #1 - Local execution
[500,0] call HG_fnc_addOrSubXP; // Adds 500
[500,1] call HG_fnc_addOrSubXP; // Subs 500
Case #2 - Remote execution
_unit refers to a player
[500,0] remoteExecCall ["HG_fnc_addOrSubXP",_unit,false]; // Adds 500
[500,1] remoteExecCall ["HG_fnc_addOrSubXP",_unit,false]; // Subs 500
Has to be enabled in config first see enableKillCount
Function
HG_fnc_addOrSubKills
Parameters
0 - INTEGER - 0 means add, 1 means subtract [default: 0]
1 - INTEGER - Amount of kills [default: 1]
Returns
Nothing
Case #1 - Local execution
[0,10] call HG_fnc_addOrSubKills; // Adds 10 kills
[1,10] call HG_fnc_addOrSubKills; // Subs 10 kills
Case #2 - Remote execution
_unit refers to a player
[0,10] remoteExecCall ["HG_fnc_addOrSubKills",_unit,false]; // Adds 10 kills
[1,10] remoteExecCall ["HG_fnc_addOrSubKills",_unit,false]; // Subs 10 kills
Function
HG_fnc_hasEnoughMoney
Parameters
0 - INTEGER - Amount of cash
1 - INTEGER - 0 means check in pockets, 1 means check in bank [default: 0]
Returns
true - Player has enough
false - Player doesn't have enough
_has500Cash = [500] call HG_fnc_hasEnoughMoney; // Returns true if HG_Cash variable >= 500 else false
_has500InBank = [500,1] call HG_fnc_hasEnoughMoney; // Returns true if HG_Bank variable >= 500 else false
Function
HG_fnc_currencyToText
Parameters
0 - INTEGER - Value you want to format
1 - BOOLEAN - If set to true it will take the currency symbol in HG_Config.h -> currencyType, unless you specify otherwise in param 2. If set to false, it will default to your game language [default: false]
2 - STRING - Currency you want to display [default: HG_Config.h -> currencyType]
Returns
STRING - Formatted text
_500Dollars = [500,true] call HG_fnc_currencyToText; // Returns $500
Function
HG_fnc_isNumeric
Parameters
None
Returns
true - Passed value is a number
false - Passed value is not a number
_isNumber = [500] call HG_fnc_isNumeric; // Returns true
_isNumber = ["Banana"] call HG_fnc_isNumeric; // Returns false
Useful for when you want to retrieve an item/vehicle/etc display name
Function
HG_fnc_getConfig
Parameters
0 - STRING - Classname
Returns
STRING - Config class
_item = "arifle_MXC_F";
_config = [_item] call HG_fnc_getConfig; // Returns "CfgWeapons"
_name = getText(configFile >> _config >> _item >> "displayName"); // Returns "MXC 6.5 mm"
Drops physical money inventory item on the ground
Function
HG_fnc_moneyItem
Parameters
0 - INTEGER - Amount of cash (has to be a multiple of 5)
1 - OBJECT - Object you want the money to be dropped at
Returns
Nothing
// I want 50 000 worth of bank notes
[50000,player] call HG_fnc_moneyItem;