diff --git a/SharedClasses/ConfigManager.cs b/SharedClasses/ConfigManager.cs
index a8de1456..cef31b75 100644
--- a/SharedClasses/ConfigManager.cs
+++ b/SharedClasses/ConfigManager.cs
@@ -82,6 +82,7 @@ public enum Setting
vmenu_dv_retries,
vmenu_dv_distance,
vmenu_freecam_toggle_key,
+ vmenu_notification_type,
}
///
diff --git a/vMenu/EventManager.cs b/vMenu/EventManager.cs
index 48055cba..d48089ad 100644
--- a/vMenu/EventManager.cs
+++ b/vMenu/EventManager.cs
@@ -40,7 +40,7 @@ public EventManager()
EventHandlers.Add("vMenu:SetPermissions", new Action(MainMenu.SetPermissions));
EventHandlers.Add("vMenu:GoToPlayer", new Action(SummonPlayer));
EventHandlers.Add("vMenu:KillMe", new Action(KillMe));
- EventHandlers.Add("vMenu:Notify", new Action(NotifyPlayer));
+ EventHandlers.Add("vMenu:Notify", new Action(NotifyPlayer));
EventHandlers.Add("vMenu:SetClouds", new Action(SetClouds));
EventHandlers.Add("vMenu:GoodBye", new Action(GoodBye));
EventHandlers.Add("vMenu:SetBanList", new Action(UpdateBanList));
@@ -339,9 +339,29 @@ private void SetClouds(float opacity, string cloudsType)
/// Used by events triggered from the server to notify a user.
///
///
- private void NotifyPlayer(string message)
+ private void NotifyPlayer(string message, string type)
{
- Notify.Custom(message, true, true);
+ if (type.ToLower() == "alert")
+ {
+ Notify.Alert(message, true, true);
+ }
+ else if (type.ToLower() == "error")
+ {
+ Notify.Error(message, true, true);
+ }
+ else if (type.ToLower() == "info")
+ {
+ Notify.Info(message, true, true);
+ }
+ else if (type.ToLower() == "success")
+ {
+ Notify.Success(message, true, true);
+ }
+ else
+ {
+ Notify.Custom(message, true, true, type);
+ }
+
}
///
diff --git a/vMenu/Freecam2/Main.cs b/vMenu/Freecam2/Main.cs
index 1775ec18..75ab407d 100644
--- a/vMenu/Freecam2/Main.cs
+++ b/vMenu/Freecam2/Main.cs
@@ -42,7 +42,7 @@ private async void ResourceStart(string Name)
IsInFreecam = !IsInFreecam;
if (IsInFreecam)
{
- TriggerEvent("mosh_notify:notify", "INFO", "You are now using Freecam²!", "info", "info", 5000);
+ //TriggerEvent("mosh_notify:notify", "INFO", "You are now using Freecam²!", "info", "info", 5000);
Notify.Success("You are now using Freecam²!");
Freecam.Enable();
}
@@ -51,7 +51,7 @@ private async void ResourceStart(string Name)
}
else
{
- TriggerEvent("mosh_notify:notify", "Error", "You are not allowed to use Freecam²!", "error", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "Error", "You are not allowed to use Freecam²!", "error", "error", 5000);
Notify.Error("You are not allowed to use Freecam²!");
}
}), false);
diff --git a/vMenu/MainMenu.cs b/vMenu/MainMenu.cs
index 0b0e8340..15673cb9 100644
--- a/vMenu/MainMenu.cs
+++ b/vMenu/MainMenu.cs
@@ -229,7 +229,7 @@ public MainMenu()
Notify.Error("You must be in the driver's seat to delete this vehicle!");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "ERROR", "You must be in the driver's seat to delete this vehicle!", "darkred", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "ERROR", "You must be in the driver's seat to delete this vehicle!", "darkred", "error", 5000);
}
}
}
@@ -247,7 +247,7 @@ public MainMenu()
Notify.Error("No vehicle found. Maybe it's not close to you?");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "ERROR", "No vehicle found. Maybe it's not close to you?", "darkred", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "ERROR", "No vehicle found. Maybe it's not close to you?", "darkred", "error", 5000);
}
}
}
@@ -269,7 +269,7 @@ public MainMenu()
Notify.Error("You do NOT have permission to use this command.");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "ERROR", "You do NOT have permission to use this command.", "darkred", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "ERROR", "You do NOT have permission to use this command.", "darkred", "error", 5000);
}
}
}), false);
@@ -292,7 +292,7 @@ static async void DelVeh(Vehicle veh, int maxtimeout, int vehicle)
Notify.Error("You can't delete this vehicle, someone else is driving it!");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "ERROR", "You can't delete this vehicle, someone else is driving it!", "darkred", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "ERROR", "You can't delete this vehicle, someone else is driving it!", "darkred", "error", 5000);
}
return;
}
@@ -312,7 +312,7 @@ static async void DelVeh(Vehicle veh, int maxtimeout, int vehicle)
Notify.Success("The vehicle has been deleted!");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "SUCCESS", "The vehicle has been deleted!", "success", "success", 5000);
+ //TriggerEvent("mosh_notify:notify", "SUCCESS", "The vehicle has been deleted!", "success", "success", 5000);
}
}
timeout++;
@@ -322,7 +322,7 @@ static async void DelVeh(Vehicle veh, int maxtimeout, int vehicle)
Notify.Error($"Failed to delete vehicle, after {maxtimeout} retries.");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "ERROR", $"Failed to delete vehicle, after {maxtimeout} retries.", "darkred", "error", 5000);
+ //TriggerEvent("mosh_notify:notify", "ERROR", $"Failed to delete vehicle, after {maxtimeout} retries.", "darkred", "error", 5000);
}
}
}
@@ -332,7 +332,7 @@ static async void DelVeh(Vehicle veh, int maxtimeout, int vehicle)
Notify.Success("The vehicle has been deleted!");
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "SUCCESS", "The vehicle has been deleted!", "success", "success", 5000);
+ //TriggerEvent("mosh_notify:notify", "SUCCESS", "The vehicle has been deleted!", "success", "success", 5000);
}
}
return;
diff --git a/vMenu/Noclip.cs b/vMenu/Noclip.cs
index e9067d06..3b534997 100644
--- a/vMenu/Noclip.cs
+++ b/vMenu/Noclip.cs
@@ -78,7 +78,7 @@ private async Task NoClipHandler()
{
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "SUCCESS", "You are now in NoClip! Press F2 to turn off NoClip.", "success", "success", 5000);
+ //TriggerEvent("mosh_notify:notify", "SUCCESS", "You are now in NoClip! Press F2 to turn off NoClip.", "success", "success", 5000);
}
Scale = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS");
while (!HasScaleformMovieLoaded(Scale))
@@ -229,7 +229,7 @@ private async Task NoClipHandler()
}
if (vMenuShared.ConfigManager.GetSettingsBool(vMenuShared.ConfigManager.Setting.pfvmenu_moshnotify_setting))
{
- TriggerEvent("mosh_notify:notify", "SUCCESS", $"Your NoClip speed is: {speeds[MovingSpeed]}.", "success", "success", 3000);
+ //TriggerEvent("mosh_notify:notify", "SUCCESS", $"Your NoClip speed is: {speeds[MovingSpeed]}.", "success", "success", 3000);
}
}
diff --git a/vMenu/Notification.cs b/vMenu/Notification.cs
index ff2bc39d..5deaacf9 100644
--- a/vMenu/Notification.cs
+++ b/vMenu/Notification.cs
@@ -33,7 +33,7 @@ public enum CommonErrors
///
/// Gets the formatted error message.
///
- public static class ErrorMessage
+ public static class ErrorMessage
{
///
/// Returns the formatted error message for the specified error type.
@@ -73,7 +73,7 @@ public static string Get(CommonErrors errorType, string placeholderValue = null)
/// Notifications class to easilly show notifications using custom made templates,
/// or completely custom style if none of the templates are fitting for the current task.
///
- public static class Notify
+ public class Notify : BaseScript
{
///
/// Show a custom notification above the minimap.
@@ -81,14 +81,37 @@ public static class Notify
/// Message to display.
/// Should the notification blink 3 times?
/// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)?
- public static void Custom(string message, bool blink = true, bool saveToBrief = true)
+ public static void Custom(string message, bool blink = true, bool saveToBrief = true, string type = "Custom")
{
- SetNotificationTextEntry("CELL_EMAIL_BCON"); // 10x ~a~
- foreach (var s in CitizenFX.Core.UI.Screen.StringToArray(message))
+ string notiftype = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_notification_type);
+
+ if (notiftype.ToLower() == "native")
{
- AddTextComponentSubstringPlayerName(s);
+ SetNotificationTextEntry("CELL_EMAIL_BCON"); // 10x ~a~
+ foreach (var s in CitizenFX.Core.UI.Screen.StringToArray(message))
+ {
+ AddTextComponentSubstringPlayerName(s);
+ }
+ DrawNotification(blink, saveToBrief);
+ }
+ else if (notiftype.ToLower() == "mosh")
+ {
+ if (!((type.ToLower()=="alert")||(type.ToLower()=="error")||(type.ToLower()=="info")||(type.ToLower()=="success")))
+ TriggerEvent("mosh_notify:notify", type, $"{message}", "info", "info", 5000);
+ }
+ else if (notiftype.ToLower() == "none")
+ {
+
+ }
+ else
+ {
+ SetNotificationTextEntry("CELL_EMAIL_BCON"); // 10x ~a~
+ foreach (var s in CitizenFX.Core.UI.Screen.StringToArray(message))
+ {
+ AddTextComponentSubstringPlayerName(s);
+ }
+ DrawNotification(blink, saveToBrief);
}
- DrawNotification(blink, saveToBrief);
}
///
@@ -99,7 +122,25 @@ public static void Custom(string message, bool blink = true, bool saveToBrief =
/// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)?
public static void Alert(string message, bool blink = true, bool saveToBrief = true)
{
- Custom("~y~~h~Alert~h~~s~: " + message, blink, saveToBrief);
+ string notiftype = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_notification_type);
+
+ if (notiftype.ToLower() == "native")
+ {
+ Custom("~y~~h~Alert~h~~s~: " + message, blink, saveToBrief, "alert");
+ }
+ else if (notiftype.ToLower() == "mosh")
+ {
+ TriggerEvent("mosh_notify:notify", "ALERT", $"{message}", "warning", "warning", 5000);
+
+ }
+ else if (notiftype.ToLower() == "none")
+ {
+
+ }
+ else
+ {
+ Custom("~y~~h~Alert~h~~s~: " + message, blink, saveToBrief, "alert");
+ }
}
///
@@ -123,7 +164,25 @@ public static void Alert(CommonErrors errorMessage, bool blink = true, bool save
/// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)?
public static void Error(string message, bool blink = true, bool saveToBrief = true)
{
- Custom("~r~~h~Error~h~~s~: " + message, blink, saveToBrief);
+ string notiftype = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_notification_type);
+
+ if (notiftype.ToLower() == "native")
+ {
+ Custom("~r~~h~Error~h~~s~: " + message, blink, saveToBrief, "error");
+ }
+ else if (notiftype.ToLower() == "mosh")
+ {
+ TriggerEvent("mosh_notify:notify", "ERROR", $"{message}", "error", "error", 5000);
+
+ }
+ else if (notiftype.ToLower() == "none")
+ {
+
+ }
+ else
+ {
+ Custom("~r~~h~Error~h~~s~: " + message, blink, saveToBrief, "error");
+ }
Debug.Write("[vMenu] [ERROR] " + message + "\n");
}
@@ -148,7 +207,25 @@ public static void Error(CommonErrors errorMessage, bool blink = true, bool save
/// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)?
public static void Info(string message, bool blink = true, bool saveToBrief = true)
{
- Custom("~b~~h~Info~h~~s~: " + message, blink, saveToBrief);
+ string notiftype = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_notification_type);
+
+ if (notiftype.ToLower() == "native")
+ {
+ Custom("~b~~h~Info~h~~s~: " + message, blink, saveToBrief, "info");
+ }
+ else if (notiftype.ToLower() == "mosh")
+ {
+ TriggerEvent("mosh_notify:notify", "INFO", $"{message}", "info", "info", 5000);
+
+ }
+ else if (notiftype.ToLower() == "none")
+ {
+
+ }
+ else
+ {
+ Custom("~b~~h~Info~h~~s~: " + message, blink, saveToBrief, "info");
+ }
}
///
@@ -159,7 +236,25 @@ public static void Info(string message, bool blink = true, bool saveToBrief = tr
/// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)?
public static void Success(string message, bool blink = true, bool saveToBrief = true)
{
- Custom("~g~~h~Success~h~~s~: " + message, blink, saveToBrief);
+ string notiftype = vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_notification_type);
+
+ if (notiftype.ToLower() == "native")
+ {
+ Custom("~g~~h~Success~h~~s~: " + message, blink, saveToBrief, "success");
+ }
+ else if (notiftype.ToLower() == "mosh")
+ {
+ TriggerEvent("mosh_notify:notify", "SUCCESS", $"{message}", "success", "success", 5000);
+
+ }
+ else if (notiftype.ToLower() == "none")
+ {
+
+ }
+ else
+ {
+ Custom("~g~~h~Success~h~~s~: " + message, blink, saveToBrief, "success");
+ }
}
///
diff --git a/vMenuServer/BanManager.cs b/vMenuServer/BanManager.cs
index da13f0cf..64ba0475 100644
--- a/vMenuServer/BanManager.cs
+++ b/vMenuServer/BanManager.cs
@@ -209,18 +209,18 @@ private void BanPlayer([FromSource] Player source, int targetPlayer, double banD
string timeRemaining = GetRemainingTimeMessage(ban.bannedUntil.Subtract(DateTime.Now));
target.Drop($"You are banned from this server. Ban time remaining: {timeRemaining}. Banned by: {ban.bannedBy}. Ban reason: {ban.banReason}. Aditional information: {vMenuShared.ConfigManager.GetSettingsString(vMenuShared.ConfigManager.Setting.vmenu_default_ban_message_information)}.");
- source.TriggerEvent("vMenu:Notify", "~g~Target player successfully banned.");
+ source.TriggerEvent("vMenu:Notify", "~g~Target player successfully banned.", "info");
}
else
{
Log("Player could not be banned because he is exempt from being banned.", LogLevel.error);
- source.TriggerEvent("vMenu:Notify", "~r~Could not ban this player, they are exempt from being banned.");
+ source.TriggerEvent("vMenu:Notify", "~r~Could not ban this player, they are exempt from being banned.", "info");
}
}
else
{
Log("Player is invalid (no longer online) and therefor the banning has failed.", LogLevel.error);
- source.TriggerEvent("vMenu:Notify", "Could not ban this player because they already left the server.");
+ source.TriggerEvent("vMenu:Notify", "Could not ban this player because they already left the server.", "info");
}
}
else
diff --git a/vMenuServer/MainServer.cs b/vMenuServer/MainServer.cs
index 096ded1c..b80173e9 100644
--- a/vMenuServer/MainServer.cs
+++ b/vMenuServer/MainServer.cs
@@ -583,7 +583,7 @@ public void DelAllVehServ([FromSource] Player source)
{
source.TriggerEvent("mosh_notify:notify", "SUCCESS", $"{vehdelnum} Vehicles Have Been Deleted!", "success", "success", 5000);
}
- source.TriggerEvent("vMenu:Notify", $"~g~Success:~s~ {vehdelnum} Vehicles Have Been Deleted!.");
+ source.TriggerEvent("vMenu:Notify", $"{vehdelnum} Vehicles Have Been Deleted!.", "success");
}
[EventHandler("vMenu:GetOutOfCar")]
@@ -594,7 +594,7 @@ internal void GetOutOfCar([FromSource] Player source, int vehicleNetId, int play
if (vMenuShared.PermissionsManager.GetPermissionAndParentPermissions(vMenuShared.PermissionsManager.Permission.PVKickPassengers).Any(perm => vMenuShared.PermissionsManager.IsAllowed(perm, source)))
{
TriggerClientEvent("vMenu:GetOutOfCar", vehicleNetId, playerOwner);
- source.TriggerEvent("vMenu:Notify", "All passengers will be kicked out as soon as the vehicle stops moving, or after 10 seconds if they refuse to stop the vehicle.");
+ source.TriggerEvent("vMenu:Notify", "All passengers will be kicked out as soon as the vehicle stops moving, or after 10 seconds if they refuse to stop the vehicle.", "info");
}
}
}
@@ -836,17 +836,17 @@ internal void KickPlayer([FromSource] Player source, int target, string kickReas
TriggerEvent("vMenu:KickSuccessful", source.Name, kickReason, targetPlayer.Name);
KickLog($"Player: {source.Name} has kicked: {targetPlayer.Name} for: {kickReason}.");
- TriggerClientEvent(player: source, eventName: "vMenu:Notify", args: $"The target player ({targetPlayer.Name}) has been kicked.");
+ TriggerClientEvent( source, "vMenu:Notify", $"The target player ({targetPlayer.Name}) has been kicked.", "info");
// Kick the player from the server using the specified reason.
DropPlayer(targetPlayer.Handle, kickReason);
return;
}
// Trigger the client event on the source player to let them know that kicking this player is not allowed.
- TriggerClientEvent(player: source, eventName: "vMenu:Notify", args: "Sorry, this player can ~r~not ~w~be kicked.");
+ TriggerClientEvent(source, "vMenu:Notify", "Sorry, this player can ~r~not ~w~be kicked.", "info");
return;
}
- TriggerClientEvent(player: source, eventName: "vMenu:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
+ TriggerClientEvent(source, "vMenu:Notify", "An unknown error occurred. Report it here: vespura.com/vmenu", "info");
}
else
{
@@ -872,7 +872,7 @@ internal void KillPlayer([FromSource] Player source, int target)
TriggerClientEvent(player: targetPlayer, eventName: "vMenu:KillMe", args: source.Name);
return;
}
- TriggerClientEvent(player: source, eventName: "vMenu:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
+ TriggerClientEvent( source, "vMenu:Notify", "An unknown error occurred. Report it here: vespura.com/vmenu", "info");
}
else
{
@@ -898,7 +898,7 @@ internal void SummonPlayer([FromSource] Player source, int target)
TriggerClientEvent(player: targetPlayer, eventName: "vMenu:GoToPlayer", args: source.Handle);
return;
}
- TriggerClientEvent(player: source, eventName: "vMenu:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
+ TriggerClientEvent( source, "vMenu:Notify", "An unknown error occurred. Report it here: vespura.com/vmenu", "info");
}
else
{
@@ -920,7 +920,7 @@ internal void SendPrivateMessage([FromSource] Player source, int targetServerId,
{
if (vMenuShared.PermissionsManager.IsAllowed(vMenuShared.PermissionsManager.Permission.OPSeePrivateMessages, p))
{
- p.TriggerEvent("vMenu:Notify", $"[vMenu Staff Log] {source.Name}~s~ sent a PM to {targetPlayer.Name}~s~: {message}");
+ p.TriggerEvent("vMenu:Notify", $"[vMenu Staff Log] {source.Name}~s~ sent a PM to {targetPlayer.Name}~s~: {message}", "");
}
}
}
@@ -931,7 +931,7 @@ internal void SendPrivateMessage([FromSource] Player source, int targetServerId,
internal void NotifySenderThatDmsAreDisabled([FromSource] Player source, string senderServerId)
{
var p = Players[int.Parse(senderServerId)];
- p?.TriggerEvent("vMenu:Notify", $"Sorry, your private message to {source.Name}~s~ could not be delivered because they disabled private messages.");
+ p?.TriggerEvent("vMenu:Notify", $"Sorry, your private message to {source.Name}~s~ could not be delivered because they disabled private messages.", "info");
}
#endregion
diff --git a/vMenuServer/config/permissions.cfg b/vMenuServer/config/permissions.cfg
index f0b7e2c1..1249fb75 100644
--- a/vMenuServer/config/permissions.cfg
+++ b/vMenuServer/config/permissions.cfg
@@ -6,6 +6,9 @@
#YOU NEED TO SET THIS
setr vmenu_individual_server_id "" # can be any ascii character and no spaces. this is technically a public value dont make it a password or something you use
+# notification settings mosh, native, none
+setr vmenu_notification_type "native"
+
# freecam
add_ace group.admin "vMenu.Freecam" allow # Allow freecam
setr vmenu_freecam_toggle_key "U" default freecam key