ok i am trying to heal the player i am looking at
my attempt
[LUA]
local eye = LocalPlayer():GetEyeTrace()
if eye.Entity:IsPlayer() then eye.Entity:SetHealth(100) end
[/LUA]
Did you get any errors?
[QUOTE=Chickengbs;51141468]Did you get any errors?[/QUOTE]
[ERROR] addons/advheal/lua/autorun/sv_init.lua:35: Tried to use a NULL entity!
1. Activate - [C]:-1
2. func - addons/advheal/lua/autorun/sv_init.lua:35
3. unknown - lua/includes/extensions/net.lua:32
Try and check if the player isValid first before initiating anything on the player.
ops that was the wrong error there was non
[editline]2nd October 2016[/editline]
[LUA]
net.Receive("HealPlayer",function()
if SERVER then
if eye.Entity:IsPlayer() then eye.Entity:SetHealth(100) end
end
end)
[/LUA]
[QUOTE=Chickengbs;51141523]Try and check if the player isValid first before initiating anything on the player.[/QUOTE]
IsPlayer checks for validity as well.
[editline]2nd October 2016[/editline]
[QUOTE=reece:D;51141564]ops that was the wrong error there was non
[editline]2nd October 2016[/editline]
[LUA]
net.Receive("HealPlayer",function()
if SERVER then
if eye.Entity:IsPlayer() then eye.Entity:SetHealth(100) end
end
end)
[/LUA][/QUOTE]
Post your net.Send code and where you're placing all of this file wise.
[QUOTE=reece:D;51141564]ops that was the wrong error there was non
[editline]2nd October 2016[/editline]
[LUA]
net.Receive("HealPlayer",function()
if SERVER then
if eye.Entity:IsPlayer() then eye.Entity:SetHealth(100) end
end
end)
[/LUA][/QUOTE]
'eye.Entity' makes no sense in this context.
[QUOTE=NeatNit;51142643]'eye.Entity' makes no sense in this context.[/QUOTE]
Neither does if SERVER, and the whole point of a net.Send makes no sense in this code as you can eyetrace server-side
Sorry, you need to Log In to post a reply to this thread.