Template:Example: Difference between revisions

From RAGE Multiplayer Wiki
(OnPlayerDisconnect)
(Replaced content with "===Example===")
Tag: Replaced
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>
===Example===
        [ServerEvent(Event.PlayerDisconnected)]
 
        public void OnPlayerDisconnect(Player player, DisconnectionType type, string reason)
        {
            if(player.HasData(PlayerVars.DataIdentifier))
            {
                player.ResetData();
            }
            switch (type)
            {
                case DisconnectionType.Left:
                    player.SendChatMessage($"~b~{player.Name}~w~ has quit the server.");
                    break;
                case DisconnectionType.Timeout:
                    player.SendChatMessage($"~b~{player.Name}~w~ has timed out.");
                    break;
                case DisconnectionType.Kicked:
                    player.SendChatMessage($"~b~{player.Name}~w~ was kicked from the server {reason}.");
                    break;
            }
        }</pre></div>

Latest revision as of 13:59, 4 May 2021

Example