silentwisher 8 Posted October 10, 2014 So I have three things I would love to setup for our server and im not sure how to do them. The first would be disabled third person. Second would be a script that checks to see if a player has a map in their inventory every like 5 seconds or so, and removes it. Third would be a script that prevents players from firing at all until a trigger is tripped in the map. (weapon lock) Any ideas? Share this post Link to post Share on other sites
iceman77 19 Posted October 11, 2014 (edited) Monitor for map + 3rd view. Disable both. To restrict firing at base, you could store and remove the player's ammo and then replace it or something. Anyhow, it's super late and I'm tired. So this is all I got for ya. Cheers. init.sqf [] spawn { if ( !isDedicated ) then { waitUntil {! ( isNull player ) }; [] spawn { while { true } do { waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) }; player globalChat "Your map has been removed!!!"; player unassignItem "ItemMap"; player removeItem "ItemMap"; }; }; while { true } do { waitUntil { cameraOn == player && { cameraView == "External" } }; player globalChat "3rd person view is not allowed!!!"; player switchCamera "Internal"; }; }; }; Edited October 11, 2014 by Iceman77 Share this post Link to post Share on other sites
silentwisher 8 Posted October 11, 2014 Thanks mate. Will try this with the crew tonight. Share this post Link to post Share on other sites
iceman77 19 Posted October 11, 2014 Changed it up a bit. Cheers. Share this post Link to post Share on other sites
silentwisher 8 Posted October 11, 2014 Everything works except the player can still access his map even after the item is removed. Share this post Link to post Share on other sites
iceman77 19 Posted October 11, 2014 (edited) Hmm. I get a black screen that says can't connect to the positioning system when I've no map. So not sure what's the issue. ---------- Post added at 15:58 ---------- Previous post was at 15:57 ---------- Note: This is in the editor, with just the above code running, with NO addons. The script works as intended. Edited October 12, 2014 by Iceman77 Share this post Link to post Share on other sites
Kerc Kasha 102 Posted October 12, 2014 If they have a GPS im pretty sure the map works aswell Share this post Link to post Share on other sites
silentwisher 8 Posted October 12, 2014 If they have a GPS im pretty sure the map works aswell Alright then maybe some how add that to the code? Share this post Link to post Share on other sites
iceman77 19 Posted October 12, 2014 [] spawn { if ( !isDedicated ) then { waitUntil {! ( isNull player ) }; [] spawn { while { true } do { waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } }; if ( "ItemMap" in ( assignedItems player ) ) then { player globalChat "Your map has been removed!!!"; player unassignItem "ItemMap"; player removeItem "ItemMap"; } else { player globalChat "Your GPS has been removed!!!"; player unassignItem "ItemGPS"; player removeItem "ItemGPS"; }; }; }; while { true } do { waitUntil { cameraOn == player && { cameraView == "External" } }; player globalChat "3rd person view is not allowed!!!"; player switchCamera "Internal"; }; }; }; Share this post Link to post Share on other sites
silentwisher 8 Posted October 12, 2014 [] spawn { if ( !isDedicated ) then { waitUntil {! ( isNull player ) }; [] spawn { while { true } do { waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } }; if ( "ItemMap" in ( assignedItems player ) ) then { player globalChat "Your map has been removed!!!"; player unassignItem "ItemMap"; player removeItem "ItemMap"; } else { player globalChat "Your GPS has been removed!!!"; player unassignItem "ItemGPS"; player removeItem "ItemGPS"; }; }; }; while { true } do { waitUntil { cameraOn == player && { cameraView == "External" } }; player globalChat "3rd person view is not allowed!!!"; player switchCamera "Internal"; }; }; }; Thank you! :) Everything works perfectly now. Appreciate it! Share this post Link to post Share on other sites
dreadedentity 278 Posted October 12, 2014 This was really fun to develop a solution for. I have 2 solutions, the first one: noMapOrGPS = (findDisplay 46) displayAddEventHandler ["KeyDown", { _handled = false; if ((_this select 1) == 50) then {_handled = true;hint "The mission-maker has disabled use of the map."}; _handled }]; This works for both the map and the GPS, an issue with it, though, is that a player simply needs to re-map his keys to circumvent this. The second solution: ["noMapOrGPS", "onEachFrame", { if (visibleMap) then { openMap false; hint "The mission maker has diabled use of the map."; }; if (visibleGPS) then { //can't put anything here as there are no commands to force-close a GPS for some reason }; }] call BIS_fnc_addStackedEventHandler; The issue here is, obviously, that it won't close a players GPS. Share this post Link to post Share on other sites
iceman77 19 Posted October 12, 2014 Thank you! :) Everything works perfectly now.Appreciate it! No worries. You could also look into the take EH. To help disallow players from acquiring either of the items in the first place. Just remove the items once initially, and forget about it. No loops or shenanigans. Cheers. Share this post Link to post Share on other sites
silentwisher 8 Posted October 13, 2014 We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no? Share this post Link to post Share on other sites
jshock 513 Posted October 13, 2014 Set the difficulty to Veteran or Elite. Share this post Link to post Share on other sites
iceman77 19 Posted October 13, 2014 We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no? If vehicle has inbuilt gps, then you're gonna have map I suppose. Regarding the 3rd view in vehicles, use vehicle player. Works for both. Updated: [] spawn { if ( !isDedicated ) then { waitUntil {! ( isNull player ) }; [] spawn { while { true } do { waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } }; if ( "ItemMap" in ( assignedItems player ) ) then { player globalChat "Your map has been removed!!!"; player unassignItem "ItemMap"; player removeItem "ItemMap"; } else { player globalChat "Your GPS has been removed!!!"; player unassignItem "ItemGPS"; player removeItem "ItemGPS"; }; }; }; while { true } do { waitUntil { cameraOn == ( vehicle player ) && { cameraView == "External" } }; player globalChat "3rd person view is not allowed!!!"; ( vehicle player ) switchCamera "Internal"; }; }; }; Share this post Link to post Share on other sites
dreadedentity 278 Posted October 13, 2014 We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no? If vehicle has inbuilt gps, then you're gonna have map I suppose. Regarding the 3rd view in vehicles, use vehicle player. Works for both. In this case, you might consider using some of the code I posted earlier, although there still is no way to close a GPS as far as I know. Share this post Link to post Share on other sites