Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Vehicle Requisition Script - Created by Oksman @ Guerrillas of Liberation for Reddit User: u/kiingkiller
- Params:
- 1: ObjNull - Action Object - Flag or Computer for example - Object will spawn 15 meters behind this object.
- 2: String - Classname of Vehicle
- 3: Integer - Cooldown Timer in Seconds
- 4: Integer - Amount of Available Vehicle of Type
- Example: [this,"B_MRAP_01_F",15,20] execVM "VehicleRequisition.sqf";
- */
- Params ["_ActionObject","_VehicleClassname","_CooldownDelay","_AvailableVehicleCount"];
- _Variable = format["OKS_VehicleRequisition_%1",_VehicleClassname];
- _VehicleName = getText (configFile >> "CfgVehicles" >> _VehicleClassname >> "displayName");
- _ActionObject setVariable [_Variable,_AvailableVehicleCount,true];
- _ActionObject addAction [
- format["<t color='#1cbf13'>Requisition %1</t>",_VehicleName], /// Action Name
- {
- //// Code
- Params ["_ActionObject","_caller","_actionId","_arguments"];
- _arguments Params ["_VehicleClassName","_Variable","_Delay"];
- if(_ActionObject getVariable [_Variable,0] > 0 && !(_ActionObject getVariable [format['%1_Deactivated',_VehicleClassname],false])) then {
- _ActionObject setVariable [format["%1_Deactivated",_VehicleClassname],true,true];
- _ActionObject setVariable [_Variable,((_ActionObject getVariable [_Variable,0]) - 1),true];
- _Dir = (getDir _ActionObject - 180);
- _Vehicle = createVehicle [_VehicleClassName, (getPos _ActionObject) getPos [15,_Dir], [], 0, "NONE"];
- _Vehicle setDir (_Vehicle getDir _ActionObject);
- _VehicleName = getText (configFile >> "CfgVehicles" >> _VehicleClassname >> "displayName");
- SystemChat format["%1 Requisitioned - Remaining: %2 - Cooldown: %3 seconds",_VehicleName,_ActionObject getVariable [_Variable,0],_Delay];
- sleep _Delay;
- _ActionObject setVariable [format["%1_Deactivated",_VehicleClassname],false,true];
- } else {
- _Message = "";
- if(_ActionObject getVariable [_Variable,0] < 1) then {
- _Message = "All vehicles spent."
- } else {
- _Message = "Cooldown still in effect."
- };
- systemChat format["Vehicle is currently unavailable. %1",_Message];
- }
- },
- [_VehicleClassname,_Variable,_CooldownDelay], /// Arguments
- 1,
- false,
- true,
- "",
- format["_target getVariable ['%1',0] > 0 && !(_target getVariable ['%1_Deactivated',false])",_Variable]
- // ^- If you want the action to always show, comment the line above. Message will be shown instead if it is unavailable.
- ];
Add Comment
Please, Sign In to add comment