Reezo 45 Posted March 12, 2011 (edited) SR5 Tactical GunSafety Scriptby Reezo - v1.0 - March 12th, 2001 This is quite a simple yet effective script. This script will automatically lower a player's weapon at the beginning of a mission and will also lower it when the player is pointing his weapon at an allied unit. The weapon will be lowered only when your aim is kept on an allied for some seconds. Put this in the init.sqf field of your mission: nul0 = [] execVM "scripts\gearing\safeweapon.sqf"; Create an empty safeweapon.sqf file in your mission folder and paste the following in it: ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: Reezo and Demonized // This script makes sure the player lowers his weapon at the beginning of the mission // and when pointing his weapon to allied units. // You stupid noobs will now stop pointing your freaking gun at everyone's face ////////////////////////////////////////////////////////////////// if (isDedicated) exitWith{}; if !(local player) exitWith{}; waitUntil {!(isNull player)}; waitUntil {player==player}; player action ["WEAPONONBACK", player]; while {alive player} do { if (side cursorTarget == side player AND (cursorTarget distance player) < 50) then { _aimAt = cursorTarget; _cntTime = 0; while {cursorTarget == _aimAt} do { sleep 1; _cntTime = _cntTime +1; }; if (_cntTime >= 5) then { player action ["WEAPONONBACK", player]; if (cameraView == "Gunner") then { player switchCamera "Internal" }; } else { sleep 5; }; }; }; if (true) exitWith{}; if you want to download it: http://www.sr5tactical.net/safeweapon.sqf Please do not mirror this file. Edited March 13, 2011 by Reezo Share this post Link to post Share on other sites
demonized 20 Posted March 12, 2011 cool enough, maybe an idea to have a distance check on the cursortarget? So as to avoid certain mishaps ;) Share this post Link to post Share on other sites
Reezo 45 Posted March 12, 2011 (edited) cool enough, maybe an idea to have a distance check on the cursortarget?So as to avoid certain mishaps ;) Fantastic idea! You would think this should apply when < 50, let's say.. UPDATED with Demonized suggestion! Edited March 12, 2011 by Reezo Share this post Link to post Share on other sites
demonized 20 Posted March 12, 2011 (edited) yeah probably. if (side cursorTarget == side player AND (cursorTarget distance player) < 50) then { also maybe add a continus check as to determine if aim is at cursor target for the whole 5 secs else do not lower weapon. This because if i point at you for a second and then points away not getting any new cursor targets i would still lower my gun, wich could potentially be hasardous to my healt, and yours after :) if (side cursorTarget == side player AND (cursorTarget distance player) < 50) then { _aimAt = cursorTarget; _cntTime = 0; while {cursorTarget == _aimAt AND _cntTime != 5} do { sleep 1; _cntTime = _cntTime +1; }; if (_cntTime >= 5) then { player action ["WEAPONONBACK", player]; if (cameraView == "Gunner") then { player switchCamera "Internal" }; } else { sleep 5; }; }; Edited March 12, 2011 by Demonized Share this post Link to post Share on other sites
Reezo 45 Posted March 12, 2011 Exactly my though, thanks for having written it. Script updated! Share this post Link to post Share on other sites