Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- waitUntil {time > 0};
- sharp_func_zone={
- params ["_zone","_timeToCap","_flag","_debug","_action","_actionScript"];
- _flag setVariable ["sharp_isCaptured",false,true];
- if !(canSuspend) exitWith {systemChat "Non-Scheduled environment, use []spawn sharp_func_zone";};
- if (_debug) then {
- systemChat format ["Zone initialised on zone %1, timetocap %2, flag %3",_zone,_timeToCap,_flag];
- };
- private _capTime=0;
- private _capped=false;
- while {true}do{
- _count0={(side _x==resistance && _x inArea _zone && alive _x)} count allUnits;
- _count1={(side _x==west && _x inArea _zone && alive _x)} count allUnits;
- if (_count0 > _count1) then {
- _capTime=_capTime+1;
- if (_debug) then {
- systemChat format ["%1 capturing: %2",_zone,_capTime];
- };
- }else{
- if (_count0==0 && _count1==0) then {
- if (_debug) then {
- systemChat format ["no one is inside the zone yet %1",_zone];
- };
- }else{
- _capTime=0;
- if (_debug) then {
- systemChat format ["%1 failed to capture",_zone];
- };
- _flag setVariable ["sharp_isCaptured",false,true];
- };
- };
- if (_capTime ==10) exitWith{
- if (_debug) then {
- systemChat format ["%1 Captured",_zone];
- };
- _flag setVariable ["sharp_isCaptured",true,true];
- //[[],{_flag addAction [_action,_actionScript];}] remoteExec ["call",resistance];
- [[_flag],
- {
- waitUntil {!isNull (findDisplay 46)};
- if !(isNil KEYDOWN_HANDLER) exitWith {};
- KEYDOWN_HANDLER=(findDisplay 46) displayAddEventHandler ["keyDown",
- {
- switch (_this select 1) do
- {
- case 35:{
- _list=nearestObjects [getPos player,[],5];
- if (count _list ==0) exitWIth {hint "No flag in range"};
- {
- if ((_x getVariable ["sharp_isCaptured","nil"]) != "nil") then {
- _isCaptured=_x getVariable ["sharp_isCaptured",false];
- if !(_isCaptured) exitWith {hint "that flag is not captured"};
- []execVM _actionScript;
- };
- }forEach _list;
- };
- };
- }];
- }]remoteExec ["spawn",resistance];
- _capped=true;
- };
- sleep 1;
- };
- waitUntil{({(side _x==resistance && _x inArea _zone && alive _x)} count allUnits < {(side _x==west && _x inArea _zone && alive _x)} count allUnits) && _capped};
- if (_debug) then {
- systemChat format ["%1 was recaptured by enemy team",_zone];
- };
- removeAllActions _flag;
- [_zone,_timeToCap,_flag,_debug,_action,_actionScript]spawn sharp_func_zone;
- };
- sleep 1;
- ["ao1",10,flag1,true,"HALO","thisScriptWillNotBeFound.sqf"]spawn sharp_func_zone;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement