Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_NotificationPlayerKicked.c
Go to the documentation of this file.
1
18{
19 [Attribute("{D3BFEE28E7D5B6A1}Configs/ServerBrowser/KickDialogs.conf", params: "conf")]
21
22 [Attribute("#AR-ServerBrowser_SessionError", desc: "If kick reason is unknown use this string", uiwidget: UIWidgets.LocaleEditBox)]
24
26 {
27 int playerID, kickCauseGroup, kickCauseReason, duration;
28 data.GetParams(playerID, kickCauseGroup, kickCauseReason, duration);
29 KickCauseCode kickCode = KickCauseCodeAPI.NewCode(kickCauseGroup, kickCauseReason);
30
31 string playerName;
32 data.GetNotificationTextEntries(playerName);
33 if (!GetPlayerName(playerID, playerName))
34 return string.Empty;
35
36 string kickReasonText = m_sUnknownKickReason;
38
39 string groupId, reasonId;
40
41 //~ Using the config display the kick reason (Same as displayed to players in MainMenu on kick/Ban). If it could not find the message it will send the m_sUnknownKickReason instead
43 {
44 KickCauseGroup2 groupInt;
45 int reasonInt;
46
47 if (GetGame().GetFullKickReason(kickCode, groupInt, reasonInt, groupId, reasonId))
48 {
49 preset = m_PlayerKickReasonsConfig.FindPreset(groupId + "_" + reasonId);
50 if (preset && !preset.m_sMessage.IsEmpty())
51 kickReasonText = preset.m_sMessage;
52 }
53 }
54 else
55 {
56 Print("SCR_NotificationPlayerKicked (kick or ban) does not have the m_PlayerKickReasonsConfig assigned with a SCR_ConfigurableDialogUiPresets config prefab!", LogLevel.ERROR);
57 }
58
59 //~ Player was kicked (0 duration) or banned (-1 duration)
60 if (duration <= 0)
61 {
62 data.SetNotificationTextEntries(playerName, kickReasonText);
63 }
64 //~ Higher then 0 so Player was temp banned
65 else
66 {
67 int days, hours, minutes, seconds;
68 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(duration, days, hours, minutes, seconds);
69
70 data.SetNotificationTextEntries(playerName, days.ToString(), hours.ToString(), minutes.ToString(), seconds.ToString(), kickReasonText);
71 }
72
73 return super.GetText(data);
74 }
75};
ENotification
ArmaReforgerScripted GetGame()
Definition game.c:1398
bool GetFullKickReason(KickCauseCode kickCode, out KickCauseGroup2 groupInt, out int reasonInt, out string group, out string reason)
Definition game.c:354
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Class for a .conf file with multiple presets.
bool GetPlayerName(int playerID, out string playerName)
override string GetText(SCR_NotificationData data)
ref SCR_ConfigurableDialogUiPresets m_PlayerKickReasonsConfig
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
KickCauseGroup2
Extends KickCauseGroup by adding game-specific groups.