Hello I’m trying to add a healing function to my paramedic script, but I can’t find my error
(I have start lua there is 5 days, sorry if it’s newbie’s errors )
Can someone help me to resolve it please ? Thank you.
I search with this function to heal the people I have target, by example /heal 1 -> I want to heal the player with the ID 1.
Code:
TriggerEvent('es:addCommand', 'heal', function(source, args, user)
TriggerEvent("es:getPlayerFromId", source, function(player)
local isParamedic = s_checkIsParamedic(player.identifier)
if(not args[2]) then
TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Usage : /heal [ID]")
else
if(GetPlayerName(tonumber(args[2])) ~= nil)then
local player = tonumber(args[2])
if(isParamedic ~= "nil") then
TriggerEvent("es:getPlayerFromId", player, function(target)
SetEntityHealth(target, 200)
TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Your blessings have been healed !")
end)
else
TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "You don't have the permission to do this !")
end
end
end
end)
end)