Added notifications to revive script.

+ Updated RP-Death script.
This commit is contained in:
Jacob
2022-04-28 19:04:56 +01:00
parent a7993c76aa
commit ab98429814
3 changed files with 50 additions and 20 deletions
BIN
View File
Binary file not shown.
+49 -19
View File
@@ -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)
+1 -1
View File
@@ -82,5 +82,5 @@ end, true)
AddEventHandler('DeathScript:AdminReturn', function(msg, id)
TriggerClientEvent("DeathScript:ShowNotification", source, msg)
TriggerClientEvent("DeathScript:ShowNotification", msg)
end)