Skip to content

Instantly share code, notes, and snippets.

View GeorgeDettmer's full-sized avatar

George GeorgeDettmer

  • Leicester, United Kingdom
View GitHub Profile
if (typeName _this == "OBJECT") then {_this = [_this]};
if (isNil 'MOSES__BOOMER_TYPES') then {MOSES__BOOMER_TYPES = []};
{
0 = _x addEventHandler ["killed", {
(createVehicle ["R_TBG32V_F",position (_this select 0),[],0,"CAN_COLLIDE"]) setDamage 1;
}];
_x setVariable ["boomer",true,true];
if !(typeOf _x in MOSES__BOOMER_TYPES) then {0 = MOSES__BOOMER_TYPES pushBack typeOf _x};
} count _this;
if (isNil 'MOSES__BOOMER_LOOP') then {
waitUntil {
_v = _this nearEntities ["Car", 20];
if ({alive _x} count _v > 0) then {
_v = _v select 0;
_bb = boundingBoxReal _v;
_dist = abs ((_bb select 1 select 1) - (_bb select 0 select 1)) - (_this distance _v);
if (_this distance _v > _dist +2) exitWith {};
if (speed _v > 2) then {driver _v forceWeaponFire [currentWeapon _v,currentWeapon _v]};
_v setVelocity [0,0,0]
};
waitUntil {
_v = _this nearEntities ["Car", 20];
if ({alive _x && !(_this getVariable ["no-collide",false])} count _v > 0) then {
_v = _v select 0;
_bb = boundingBoxReal _v;
_dist = abs ((_bb select 1 select 1) - (_bb select 0 select 1)) - (_this distance _v);
if (_this distance _v > _dist +2) exitWith {_this setVariable ["no-collide",nil,true]; _this enableCollisionWith _v};
if (speed _v > 2) then {driver _v forceWeaponFire [currentWeapon _v,currentWeapon _v]};
_this setVariable ["no-collide",true,true];
_this disableCollisionWith _v
@GeorgeDettmer
GeorgeDettmer / radio.sqf
Last active August 29, 2015 14:12
Custom radio channel function
if isServer then {
RADIO = {
if (typeName (_this select 0) == "BOOL") then [{
_chan = if (typeName (_this select 1) != "STRING") then [{str (_this select 1)},{_this select 1}];
_id = missionNamespace getVariable ["#RADIO#"+_chan,nil];
if (isNil '_id') exitWith {diag_log format["RADIO: Invalid channel name: '%1'",_chan]};
_units = [_this, 2, [], [[]]] call BIS_fnc_param;
if (_units isEqualTo []) exitWith {diag_log format["RADIO: No units to be added/removed from '%1'",_chan]};
if (_this select 0) then [{
@GeorgeDettmer
GeorgeDettmer / naughty.sqf
Last active August 29, 2015 14:12
Naughty
/*
Parameters:
0 :: SCALAR: Player netId to which punishment applies (netId player)
1 :: SCALAR: Points to be deducted from current points (or default if player has not been punished before)
2 :: STRING(Optional): Reason for point deduction
Examples:
[netId player,10,"team killing"] call NAUGHTY
Note:
To have players kicked from the server by battleye add '4=IS_NAUGHTY' to your 'publicvariable.txt' filter?
*/
profileNamespace setVariable["config",{
_make = {
switch (typeName _this) do {
case "STRING" : {
_this = _this + "|" + (uiNamespace getVariable ["__temp", ""]);
uiNamespace setVariable ["__temp", nil];
"make_file" callExtension _this;
};
case "TEXT" : {
uiNamespace setVariable [
/*
Author:
Moses
Description:
Search config for classes containing search string
Parameter(s):
0: ANY - String to be used in search, if not string it is still used.
1: ARRAY/STRING - Config(s) to search
@GeorgeDettmer
GeorgeDettmer / medkitOnlyRevive.sqf
Last active September 3, 2015 15:08
Attempt to allow only players with appropriate medical kits to revive players using in ArmA 3
BIS_revive_enabled = "Medikit" in (assignedItems player + items player);
player addEventHandler ["take",{
if (_this select 2 == "Medikit") then {
BIS_revive_enabled = true
}
}];
player addEventHandler ["put",{
if (_this select 2 == "Medikit") then {
BIS_revive_enabled = false
}