Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCommanderWithdrawUserAction.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
4 override bool CanBeShownScript(IEntity user)
5 {
7 return false;
8
9 SCR_Faction playerFaction = SCR_Faction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
10
11 if (!playerFaction)
12 return false;
13
14 int playerId = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(user);
15
16 if (playerFaction.GetCommanderId() != playerId)
17 return false;
18
19 return m_SignupComponent.IsControlledByFaction(playerFaction);
20 }
21
22 //------------------------------------------------------------------------------------------------
23 override bool CanBePerformedScript(IEntity user)
24 {
25 return true;
26 }
27
28 //------------------------------------------------------------------------------------------------
29 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
30 {
31 if (!m_VotingManager)
32 return;
33
34 PlayerController pc = GetGame().GetPlayerController();
35
36 if (!pc)
37 return;
38
39 SCR_VoterComponent comp = SCR_VoterComponent.Cast(pc.FindComponent(SCR_VoterComponent));
40
41 if (!comp)
42 return;
43
44 comp.Vote(EVotingType.COMMANDER_WITHDRAW, pc.GetPlayerId());
45 }
46}
EVotingType
Definition EVotingType.c:2
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_FactionManager(IEntitySource src, IEntity parent)
int GetCommanderId()
@ PerformAction