ACR_ServerCommunicator.ACR_ServerCommunicator.IsCrossServerNotificationEnabled C# (CSharp) Method

IsCrossServerNotificationEnabled() public method

Get whether a player wishes to receive cross server event notifications.
public IsCrossServerNotificationEnabled ( uint PlayerObject ) : bool
PlayerObject uint Supplies the PC object to query.
return bool
        public bool IsCrossServerNotificationEnabled(uint PlayerObject)
        {
            return (GetPlayerState(PlayerObject).Flags & PlayerStateFlags.DisableCrossServerNotifications) == 0;
        }

Usage Example

        /// <summary>
        /// Dispatch the event (in a script context).
        /// </summary>
        /// <param name="Script">Supplies the script object.</param>
        /// <param name="Database">Supplies the database connection.</param>
        public void DispatchEvent(ACR_ServerCommunicator Script, ALFA.Database Database)
        {
            //
            // If the event was for the local server, then don't re-broadcast
            // it.
            //

            if (Database.ACR_GetServerID() == Server.ServerId)
                return;

            string Message = String.Format(
                "<c=#FFFF00>Server {0} is now offline.</c>",
                Server.Name);
            string ChatMessage = "</c>" + Message;

            foreach (uint PlayerObject in Script.GetPlayers(true))
            {
                PlayerState Player = Script.TryGetPlayerState(PlayerObject);

                if (Player == null)
                    continue;

                if (!Script.IsCrossServerNotificationEnabled(PlayerObject))
                    continue;

                if ((Player.Flags & PlayerStateFlags.SendCrossServerNotificationsToCombatLog) != 0)
                {
                    Script.SendMessageToPC(PlayerObject, Message);
                }
                else
                {
                    Script.SendChatMessage(
                        CLRScriptBase.OBJECT_INVALID,
                        PlayerObject,
                        CLRScriptBase.CHAT_MODE_SERVER,
                        ChatMessage,
                        CLRScriptBase.FALSE);
                }
            }

#if DEBUG_MODE
            Script.WriteTimestampedLogEntry(Message);
#endif
        }
All Usage Examples Of ACR_ServerCommunicator.ACR_ServerCommunicator::IsCrossServerNotificationEnabled
ACR_ServerCommunicator