From ab984298145b0656aefae71ea7559c45021d06f5 Mon Sep 17 00:00:00 2001 From: Jacob <42719082+ThatGuyJacobee@users.noreply.github.com> Date: Thu, 28 Apr 2022 19:04:56 +0100 Subject: [PATCH] Added notifications to revive script. + Updated RP-Death script. --- hypnonema.db | Bin 28672 -> 28672 bytes resources/RP-Death/client.lua | 68 ++++++++++++++++++++++++---------- resources/RP-Death/server.lua | 2 +- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/hypnonema.db b/hypnonema.db index 555af39079dd6b304d7c5080a148783f03d0761d..1e5565b6aa6d4804b2c6b4d2a021aa87ebbe742a 100644 GIT binary patch delta 23 dcmZp8z}WDBae^tkHN$@(V4K*exiNKiJ^+D<3nu^o delta 23 dcmZp8z}WDBae^tkCBuIpV4K*exiNKiJ^+Dj3nc&m diff --git a/resources/RP-Death/client.lua b/resources/RP-Death/client.lua index bd096dc6f..68a6b0d39 100644 --- a/resources/RP-Death/client.lua +++ b/resources/RP-Death/client.lua @@ -92,21 +92,41 @@ Citizen.CreateThread(function() if ReviveTime > 0 then ReviveTime = ReviveTime - 5 - reviveMessage = '~r~Revive in ' .. ReviveTime .. ' seconds' + --exports['EGRP-Notifications']:CaptionIcon("System", "You can revive in "..ReviveTime.." seconds!", "top", 3000, "dark", "", true, "mdi-medical-bag") + reviveMessage = "You can revive in "..ReviveTime.." seconds!" else ReviveAllowed = true - reviveMessage = '~g~Revive available | /revive' + --exports['EGRP-Notifications']:CaptionIcon("System", "You can revive now!", "top", 3000, "dark", "", true, "mdi-medical-bag") + reviveMessage = "You can /revive now!" end if RespawnTime > 0 then RespawnTime = RespawnTime - 5 - respawnMessage = '~r~Respawn in ' .. RespawnTime .. ' seconds' + --exports['EGRP-Notifications']:CaptionIcon("System", "You can respawn in "..RespawnTime.." seconds!", "top", 3000, "dark", "", true, "mdi-truck-plus") + respawnMessage = "You can respawn in "..RespawnTime.." seconds!" else RespawnAllowed = true - respawnMessage = '~g~Respawn available | /respawn' + --exports['EGRP-Notifications']:CaptionIcon("System", "You can respawn now!", "top", 3000, "dark", "", true, "mdi-truck-plus") + respawnMessage = "You can /respawn now!" end + + if ReviveAllowed and RespawnAllowed then + exports['EGRP-Notifications']:Info("System", ""..reviveMessage.." "..respawnMessage.."", "top", 3000, true) + + elseif ReviveAllowed and not RespawnAllowed then + exports['EGRP-Notifications']:Info("System", ""..reviveMessage.."", "top", 3000, true) + exports['EGRP-Notifications']:CaptionIcon("System", ""..respawnMessage.."", "top", 3000, "dark", "", true, "mdi-medical-bag") + + elseif not ReviveAllowed and RespawnAllowed then + exports['EGRP-Notifications']:Info("System", ""..respawnMessage.."", "top", 3000, true) + exports['EGRP-Notifications']:CaptionIcon("System", ""..reviveMessage.."", "top", 3000, "dark", "", true, "mdi-medical-bag") + + elseif not ReviveAllowed and not RespawnAllowed then + exports['EGRP-Notifications']:CaptionIcon("System", ""..reviveMessage.." "..respawnMessage.."", "top", 3000, "dark", "", true, "mdi-medical-bag") - ShowNotification( respawnMessage .. '\n' .. reviveMessage ) + end + + --ShowNotification( respawnMessage .. '\n' .. reviveMessage ) else respawnPed( ped, spawnPoints[math.random(1,#spawnPoints)] ) @@ -126,7 +146,8 @@ AddEventHandler("DeathScript:Revive", function( adrev, admin, all) if all then revivePed( ped ) resetTimers() - ShowNotification("~g~You have been revived by an admin!") + exports['EGRP-Notifications']:Success("System", "You have been revived by an admin!", "top", 5000, true) + --ShowNotification("~g~You have been revived by an admin!") return; end if GetEntityHealth( ped ) <= 1 then --if you are dead @@ -135,17 +156,20 @@ AddEventHandler("DeathScript:Revive", function( adrev, admin, all) revivePed( ped ) resetTimers() if adrev then - ShowNotification("~g~You have been revived by an admin!") - TriggerServerEvent('DeathScript:AdminReturn', '~g~Player have been revived', admin) + exports['EGRP-Notifications']:Success("System", "You have been revived by an admin!", "top", 5000, true) + --ShowNotification("~g~You have been revived by an admin!") + TriggerServerEvent('DeathScript:AdminReturn', admin) end else - ShowNotification("~r~" .. ReviveTime .. ' seconds remaining until revive!') + exports['EGRP-Notifications']:CaptionIcon("System", "You can revive in "..ReviveTime.." seconds!", "top", 3000, "dark", "", true, "mdi-medical-bag") + --ShowNotification("~r~" .. ReviveTime .. ' seconds remaining until revive!') end else if adrev then - TriggerServerEvent('DeathScript:AdminReturn', '~r~Player is alive', admin) + TriggerServerEvent('DeathScript:AdminReturn', admin) else - ShowNotification("~g~You're alive!") + exports['EGRP-Notifications']:Negative("System", "You can't revive yourself when you're alive!", "top", 3000, true) + --ShowNotification("~g~You're alive!") end end end) @@ -156,7 +180,8 @@ AddEventHandler("DeathScript:Respawn", function( adres, admin, all) if all then respawnPed( ped, spawnPoints[math.random(1,#spawnPoints)] ) resetTimers() - ShowNotification("~g~You have been respawned by an admin!") + exports['EGRP-Notifications']:Success("System", "You have been respawned by an admin!", "top", 5000, true) + --ShowNotification("~g~You have been respawned by an admin!") return; end if GetEntityHealth( ped ) <= 1 then --if you are dead @@ -165,17 +190,20 @@ AddEventHandler("DeathScript:Respawn", function( adres, admin, all) respawnPed( ped, spawnPoints[math.random(1,#spawnPoints)] ) resetTimers() if adres then - ShowNotification("~g~You have been respawned by an admin!") - TriggerServerEvent('DeathScript:AdminReturn', '~g~Player have been respawned', admin) + exports['EGRP-Notifications']:Success("System", "You have been respawned by an admin!", "top", 5000, true) + --ShowNotification("~g~You have been respawned by an admin!") + TriggerServerEvent('DeathScript:AdminReturn', admin) end else - ShowNotification("~r~" .. RespawnTime .. ' seconds remaining until respawn!') + exports['EGRP-Notifications']:CaptionIcon("System", "You can respawn in "..RespawnTime.." seconds!", "top", 3000, "dark", "", true, "mdi-medical-bag") + --ShowNotification("~r~" .. RespawnTime .. ' seconds remaining until respawn!') end else if adres then - TriggerServerEvent('DeathScript:AdminReturn', '~r~Player is alive', admin) + TriggerServerEvent('DeathScript:AdminReturn', admin) else - ShowNotification("~g~You're alive!") + exports['EGRP-Notifications']:Negative("System", "You can't respawn when you're alive!", "top", 3000, true) + --ShowNotification("~g~You're alive!") end end end) @@ -183,9 +211,11 @@ end) AddEventHandler('DeathScript:Toggle', function() DeathScriptToggle = not DeathScriptToggle if (DeathScriptToggle) then - ShowNotification("~b~DeathScript was enabled") + exports['EGRP-Notifications']:Success("System", "RP-Death has been enabled!", "top", 3000, true) + --ShowNotification("~b~DeathScript was enabled") else - ShowNotification("~r~DeathScript was disabled") + exports['EGRP-Notifications']:Negative("System", "RP-Death has been disabled!", "top", 3000, true) + --ShowNotification("~r~DeathScript was disabled") end end) diff --git a/resources/RP-Death/server.lua b/resources/RP-Death/server.lua index 512c226ac..295b956f2 100644 --- a/resources/RP-Death/server.lua +++ b/resources/RP-Death/server.lua @@ -82,5 +82,5 @@ end, true) AddEventHandler('DeathScript:AdminReturn', function(msg, id) - TriggerClientEvent("DeathScript:ShowNotification", source, msg) + TriggerClientEvent("DeathScript:ShowNotification", msg) end) \ No newline at end of file