Notice
Player notification and messaging system for the Lilia framework.
Overview
lia.notices.receiveNotify()
Purpose
Receives notification data from the server via network message, allows overriding behavior via a unified hook, and displays it to the client.
When Called
Automatically called when the client receives a "liaNotificationData" network message from the server.
Example Usage
hook.Add("LiliaNoticeOverride", "CustomNoticeHandler", function(msg, ntype)
if ntype == "error" then
chat.AddText(Color(255, 0, 0), "[ERROR] " .. msg)
return true
end
end)
lia.notices.receiveNotifyL()
Purpose
Receives localized notification data from the server, resolves it into a string, allows overriding via a unified hook, and displays it to the client.
When Called
Automatically called when the client receives a "liaNotifyLocal" network message from the server.
Example Usage
hook.Add("LiliaNoticeOverride", "CustomLocalizedHandler", function(msg, ntype)
if string.find(msg, "inventory") then
return {
message = "[Inventory] " .. msg,
type = "warning"
}
end
end)
lia.notices.notifyInfoLocalized(client, key)
Purpose
Sends an informational notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send an info-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifyInfoLocalized(player, "item.purchased", itemName, price)
lia.notices.notifyInfoLocalized(nil, "server.restart", "5")
lia.notices.notifyWarningLocalized(client, key)
Purpose
Sends a warning notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send a warning-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifyWarningLocalized(player, "inventory.full")
lia.notices.notifyWarningLocalized(nil, "server.maintenance", "30")
lia.notices.notifyErrorLocalized(client, key)
Purpose
Sends an error notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send an error-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifyErrorLocalized(player, "command.noPermission")
lia.notices.notifyErrorLocalized(nil, "server.error", errorCode)
lia.notices.notifySuccessLocalized(client, key)
Purpose
Sends a success notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send a success-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifySuccessLocalized(player, "quest.completed", questName)
lia.notices.notifySuccessLocalized(nil, "server.update.complete")
lia.notices.notifyMoneyLocalized(client, key)
Purpose
Sends a money-related notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send a money-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifyMoneyLocalized(player, "money.earned", amount, reason)
lia.notices.notifyMoneyLocalized(nil, "lottery.winner", winnerName, prize)
lia.notices.notifyAdminLocalized(client, key)
Purpose
Sends an admin-related notification to a client using a localized message key with optional parameters.
When Called
Called when you want to send an admin-type notification with localized text to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string key The localization key for the message.
Example Usage
lia.notices.notifyAdminLocalized(player, "admin.kicked", reason)
lia.notices.notifyAdminLocalized(nil, "admin.announcement", message)
lia.notices.notifyLocalized(client, key, notifType)
Purpose
Sends a localized notification to a client or all clients, handling both server-side networking and client-side display.
When Called
Called when you want to send a notification using a localization key with variable arguments to a specific client or all clients.
Parameters
Player|string client optional The player to send the notification to, or the first argument if not a player. If nil, sends to all players.
string key The localization key for the message.
string notifType The type of notification (e.g., "info", "warning", "error", "success").
Example Usage
lia.notices.notifyLocalized(player, "item.purchased", "success", itemName, price)
lia.notices.notifyLocalized(nil, "server.restart", "warning", "5")
lia.notices.notifyLocalized(nil, "ui.button.clicked", "info")
lia.notices.notify(client, message, notifType)
Purpose
Sends a text notification to a client or all clients, handling both server-side networking and client-side display with sound and visual effects.
When Called
Called when you want to send a notification with plain text (not localized) to a specific client or all clients.
Parameters
Player client optional The player to send the notification to. If nil, sends to all players.
string message The notification message text to display.
string notifType The type of notification (e.g., "default", "info", "warning", "error", "success", "money", "admin").
Example Usage
lia.notices.notify(player, "You have received 100 credits!", "money")
lia.notices.notify(nil, "Server restarting in 5 minutes", "warning")
lia.notices.notify(nil, "Welcome to the server!", "info")