Skip to content

Commit

Permalink
[FIX] Elections, Central and FakeHC
Browse files Browse the repository at this point in the history
  • Loading branch information
Armitxes committed Dec 30, 2016
1 parent 60da73d commit ea60a50
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 185 deletions.
92 changes: 46 additions & 46 deletions armitxes/elections.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ _currentChief = -1;
_currentMayor = -1;

while {true} do {
sleep 10;
if (lastElection+35 <= (time/60)) then {
lastElection = (time/60); publicVariable "lastElection";
_msg = "";
//PM
_MaxStimmen = 0;
_MaxPos = -1;
_WahlArray = server getVariable "PMVote";
sleep 10;
if (lastElection+35 <= (time/60)) then {
lastElection = (time/60); publicVariable "lastElection";
_msg = "";

//PM
_MaxStimmen = 0;
_MaxPos = -1;
_WahlArray = server getVariable "PMVote";

for [{_i=0}, {_i < count(_WahlArray)}, {_i=_i+1}] do {
private["_player_variable_name", "_player_variable"];
Expand All @@ -28,7 +28,7 @@ while {true} do {
};

if (_MaxPos == -1) then {
_msg = "No Prime Minister has been elected.";
_msg = "No Prime Minister has been elected.";
_currentMayor = -1;
} else {
if (_currentMayor == _MaxPos) then {
Expand All @@ -41,40 +41,40 @@ while {true} do {
};
};

MayorNumber = _currentMayor;
publicVariable "MayorNumber";
// CC
_MaxStimmen = 0;
_MaxPos = -1;
_WahlArrayc = server getVariable "CCVote";
for [{_i=0}, {_i < count(_WahlArrayc)}, {_i=_i+1}] do {
_player_variable_name = (playerstringarray select _i);
_player_variable = missionNamespace getVariable [_player_variable_name, objNull];
if ((count (_WahlArrayc select _i)) > _MaxStimmen) then {
if !(isNil "_player_variable") then {
if !(isNull _player_variable) then {
_MaxStimmen = (count (_WahlArrayc select _i));
_MaxPos = _i;
};
};
};
};
if (_MaxPos == -1) then { _msg = format ["%1 No Chief Constable has been elected.",_msg]; _currentChief = -1; }
else {
if (_currentChief == _MaxPos) then { _msg = format ["%1 The current Chief Constable stays.",_msg]; }
else {
_currentChief = _MaxPos;
_chiefString = (playerstringarray select _currentChief);
_msg = format ["%1 %2 is now the Chief Constable!",_msg,_chiefString];
};
};
chiefNumber = _currentChief;
PUBLICVARIABLE "chiefNumber";
(format["hint ""%1""; if ((rolenumber-1) == %2) then {isMayor = true;} else {isMayor = false;}; if ((rolenumber-1) == %3) then {ischief = true;} else {ischief = false;};",_msg,MayorNumber,chiefNumber]) call toClients;
};
MayorNumber = _currentMayor;
publicVariable "MayorNumber";

// CC
_MaxStimmen = 0;
_MaxPos = -1;
_WahlArrayc = server getVariable "CCVote";

for [{_i=0}, {_i < count(_WahlArrayc)}, {_i=_i+1}] do {
_player_variable_name = (playerstringarray select _i);
_player_variable = missionNamespace getVariable [_player_variable_name, objNull];

if ((count (_WahlArrayc select _i)) > _MaxStimmen) then {
if !(isNil "_player_variable") then {
if !(isNull _player_variable) then {
_MaxStimmen = (count (_WahlArrayc select _i));
_MaxPos = _i;
};
};
};
};

if (_MaxPos == -1) then { _msg = format ["%1 No Chief Constable has been elected.",_msg]; _currentChief = -1; }
else {
if (_currentChief == _MaxPos) then { _msg = format ["%1 The current Chief Constable stays.",_msg]; }
else {
_currentChief = _MaxPos;
_chiefString = (playerstringarray select _currentChief);
_msg = format ["%1 %2 is now the Chief Constable!",_msg,_chiefString];
};
};

chiefNumber = _currentChief;
PUBLICVARIABLE "chiefNumber";
(format["hint ""%1""; if ((rolenumber-1) == %2) then {isMayor = true;} else {isMayor = false;}; if ((rolenumber-1) == %3) then {ischief = true;} else {ischief = false;};",_msg,MayorNumber,chiefNumber]) call toClients;
};
};
4 changes: 2 additions & 2 deletions armitxes/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(!isDedicated) then {
isun = false;
isciv = false;
PLAYERDATA = [0];

if(enableDebug) then {
PLAYERDATA = [1,300000,245,4,2,50,[],0,[],0,''];
if ((count PLAYERDATA) == 11) then {
Expand Down Expand Up @@ -52,6 +52,6 @@ if(!isDedicated) then {
waitUntil { !dialog };
};
if(isciv && (PLAYERDATA select 9) == 2) then {player setPos (getMarkerPos "respawn_civilian2");};
["elections",false] call execARM;
[] execVM "elections.sqf";
civstatsdone = true;
};
2 changes: 1 addition & 1 deletion description.ext
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ disabledAI = 1;

// Define UN Custom GPS Skin
onMinimapScript[] = {"BIS_fnc_customGPS_Spawn"};
class Header {gameType = Team; minPlayers = 1; maxPlayers = 77;};
class Header {gameType = Life; minPlayers = 1; maxPlayers = 77;};

disableChannels[]={0,2};

Expand Down
4 changes: 2 additions & 2 deletions init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if (isServer) then {
while {true} do {
svrStats = [diag_fps,time]; publicVariable "svrStats"; sleep 300;
_serverId = owner server;
if (isNull fakeHcClient || owner unoCommander == _serverId) then {
if (isNull fakeHcClient) then {
_newClient = objNull;
{ if (isPlayer _x) exitWith { _newClient = _x; }; } forEach civarray;
fakeHcClient = _newClient;
Expand All @@ -117,7 +117,7 @@ if (isServer) then {
};
} forEach (nearestObjects [[6453,8127,0],["Man","Animal"], 9000]);
prisondoor setOwner (owner fakeHcClient);
prisonDoor3 setOwner (owner fakeHcClient);
prisonDoor2 setOwner (owner fakeHcClient);
};
};
};
Expand Down
Loading

0 comments on commit ea60a50

Please sign in to comment.