From 1ab85e7a0b4c6672ee4101bf2409e389dbe50f38 Mon Sep 17 00:00:00 2001 From: IT07 Date: Sat, 16 Apr 2016 13:11:56 +0200 Subject: [PATCH] Welcome to the club --- exile_vemf_reloaded/sqf/handleRespectGain.sqf | 96 +++++++++++++++++++ exile_vemf_reloaded/sqf/sayKilledWeapon.sqf | 42 ++++++++ 2 files changed, 138 insertions(+) create mode 100644 exile_vemf_reloaded/sqf/handleRespectGain.sqf create mode 100644 exile_vemf_reloaded/sqf/sayKilledWeapon.sqf diff --git a/exile_vemf_reloaded/sqf/handleRespectGain.sqf b/exile_vemf_reloaded/sqf/handleRespectGain.sqf new file mode 100644 index 0000000..a71e0be --- /dev/null +++ b/exile_vemf_reloaded/sqf/handleRespectGain.sqf @@ -0,0 +1,96 @@ +_target = param [0, objNull, [objNull]]; +_killer = param [1, objNull, [objNull]]; +if not(isNull _target AND isNull _killer) then +{ + scopeName "outer"; + _respectReward = "respectReward" call VEMFr_fnc_getSetting; + if (_respectReward > 1) then + { + _message = [[]]; + _killMsg = selectRandom ["AI WACKED","AI CLIPPED","AI DISABLED","AI DISQUALIFIED","AI WIPED","AI ERASED","AI LYNCHED","AI WRECKED","AI NEUTRALIZED","AI SNUFFED","AI WASTED","AI ZAPPED"]; + (_message select 0) pushBack [_killMsg,_respectReward]; + _dist = _target distance _killer; + private ["_distanceOk"]; + if (_dist < 2500) then + { + scopeName "below2500"; + if (_dist <= 5) then + { + (_message select 0) pushBack ["CQB Master", 25]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 10) then + { + (_message select 0) pushBack ["Close one", 15]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 50) then + { + (_message select 0) pushBack ["Danger close", 15]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 100) then + { + (_message select 0) pushBack ["Lethal aim", 20]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 200) then + { + (_message select 0) pushBack ["Deadly.", 25]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 500) then + { + (_message select 0) pushBack ["Niiiiice.", 30]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 1000) then + { + (_message select 0) pushBack ["Dat distance...", 45]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist <= 2000) then + { + (_message select 0) pushBack ["Danger far.", 50]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + if (_dist > 2000) then + { + (_message select 0) pushBack [format["hax? %1m!!!", round _dist], 65]; + _distanceOk = true; + _distanceOk breakOut "below2500"; + }; + }; + + if _distanceOk then + { + _curRespect = _killer getVariable ["ExileScore", nil]; + if not(isNil"_curRespect") then + { + _respectToGive = (((_message select 0) select 1) select 1); + _newRespect = _curRespect + _respectToGive + _respectReward; + _killer setVariable ["ExileScore", _newRespect]; + ExileClientPlayerScore = _newRespect; + (owner _killer) publicVariableClient "ExileClientPlayerScore"; + ExileClientPlayerScore = nil; + [_killer, "showFragRequest", _message] call ExileServer_system_network_send_to; + format["setAccountMoneyAndRespect:%1:%2:%3", _killer getVariable ["ExileMoney", 0], _newRespect, (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget; + } else + { + ["fn_aiKilled", 0, format["Failed to get respect from %1 (%2)", name _killer, _killer]] spawn VEMFr_fnc_log; + }; + } else + { + ["handleKillMessage", 0, format["There is something wrong with the kill distance (%1)", _dist]] spawn VEMFr_fnc_log; + breakOut "outer"; // Stop doing anything after this line + }; + }; +}; diff --git a/exile_vemf_reloaded/sqf/sayKilledWeapon.sqf b/exile_vemf_reloaded/sqf/sayKilledWeapon.sqf new file mode 100644 index 0000000..3d7f3ec --- /dev/null +++ b/exile_vemf_reloaded/sqf/sayKilledWeapon.sqf @@ -0,0 +1,42 @@ +/* + Author: IT07 + + Description: + handles the broadcast of a systemChat kill message +*/ + +_killer = param [0, objNull, [objNull]]; +if not isNull _killer then +{ + scopeName "outer"; + _dist = _target distance _killer; + if (_dist > 1) then + { + private ["_curWeapon"]; + if (vehicle _killer isEqualTo _killer) then // If on foot + { + _curWeapon = currentWeapon _killer; + }; + if not(vehicle _killer isEqualTo _killer) then // If in vehicle + { + _curWeapon = currentWeapon (vehicle _killer); + }; + _sayKilled = param [1, 1, [1]]; + if (_sayKilled isEqualTo 1) then + { + _kMsg = format["(VEMFr) %1 [%2, %3m] AI", name _killer, getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist]; + [_kMsg, "sys"] spawn VEMFr_fnc_broadCast; + breakOut "outer"; + }; + if (_sayKilled isEqualTo 2) then + { + VEMFrClientMsg = [format["(VEMFr) You [%1, %2m] AI", getText(configFile >> "CfgWeapons" >> _curWeapon >> "displayName"), round _dist], "sys"]; + (owner _killer) publicVariableClient "VEMFrClientMsg"; + VEMFrClientMsg = nil; + breakOut "outer"; + }; + }; +} else +{ + ["sayKilledWeapon.sqf", 0, "_killer isNull!"] spawn VEMFr_fnc_log; +};