From 9e811035acbfa2973fcd01462ef0149d0a58ee7a Mon Sep 17 00:00:00 2001 From: BrendonSmith <81374445+Brendon85@users.noreply.github.com> Date: Mon, 21 Oct 2024 00:37:03 +0800 Subject: [PATCH] Update main.lua add condition player --- client/main.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index ea82fd7..fba4691 100644 --- a/client/main.lua +++ b/client/main.lua @@ -325,7 +325,19 @@ AddEventHandler('redemrp_skin:LoadSkinClient', function() TriggerServerEvent("RedEM:server:LoadSkin") end) -RegisterCommand('loadskin', function(source, args, raw) +RegisterCommand('reloadskin', function(_, _, _) + local ped = PlayerPedId() + local isDead = IsEntityDead(ped) + local isDying = IsPedDeadOrDying(ped, true) + local isVehicle = IsPedInAnyVehicle(ped, true) + local health = GetEntityHealth(ped) + local healthCore = GetAttributeCoreValue(ped, 0) + + if isDead or isDying or isVehicle or health <= 100 or healthCore <= 100 then + TriggerEvent('redem_roleplay:NotifyLeft', "Hey", "You can't use this command when you are dying or in a vehicle", "scoretimer_textures", "scoretimer_generic_cross", 3000) + return + end + TriggerServerEvent("RedEM:server:LoadSkin", true) end)