Hello I try to create a medic job so i want to heal a player near to me, I can get his ped but when I’m calling SetEntityHealth(ped, 200) with his ped it doesn’t work but work if it’s on me…
Citizen.CreateThread(function() -- create a thread
while true do -- loop through this code infinitely
Citizen.Wait(0) -- required in an infinite loop or it will crash
if (IsControlJustPressed(1, 57)) then
local player = getNearPlayer()
if (player ~= nil) then
local ped = GetPlayerPed(player)
SetEntityHealth(ped, GetEntityMaxHealth(ped))
end
end
if (IsControlJustPressed(1, 56)) then
SetEntityHealth(GetPlayerPed(-1), GetEntityMaxHealth(GetPlayerPed(-1)))
end
end
end)
Yes I’m pretty sure because when I do : SetEntityHealth(ped, GetEntityMaxHealth(ped))
I’ve got a notification about the player death but he doesn’t die
But I’ll retry with your function but I think I’ve already try
I have some problem at my server…do you guys know how to fix godmode player?in vmenu they dont have menu godmod…only happen to 1-2 player…when i shot they didnt die…help anyone?