I need a code that I'm unable to create by myself urgently

I’m pretty new in all this Developing Codeing Stuff, now I need a code for this Situation “Whenever a player is getting hurt said player will be teleported to the point he/she is looking at”
I don’t really know how to create it, so please if someone got the time, do it for me and if you have enough time link wiki pages I would need to create it by myself.

GM:EntityTakeDamage

Entity:IsPlayer

Entity:SetPos

Player:GetEyeTrace

hook.Add(“EntityTakeDamage”, “IsPlayer”, “SetPos”, “GetEyeTrace”, function( target, dmg ) target:SetPos(IsPlayer())
print( Entity(1):GetEyeTrace().Entity )

print( player.GetByID( 1 ):IsPlayer() )
print(ents.FindByClass( "prop_physics" )[ 1 ]:IsPlayer() )

Please don’t tell me that I’m too stupid. I Need that Code till tommorow morning, so please tell me what’s wrong and correct it.

[editline]28th December 2016[/editline]

hook.Add(“EntityTakeDamage”, “IsPlayer”, “SetPos”, “GetEyeTrace”, function( target, dmg ) target:SetPos(IsPlayer())
print( Entity(1):GetEyeTrace().Entity )

print( player.GetByID( 1 ):IsPlayer() )
print(ents.FindByClass( "prop_physics" )[ 1 ]:IsPlayer() )

Please don’t tell me that I’m too stupid. I Need that Code till tommorow morning, so please tell me what’s wrong and correct it.
Can’t test it rn because I can’t reach a Computer with GMod installed.

If you wish to learn how to learn how to customize your server outside of it’s current configuration.
You’re gonna need pre-requisite technical knowledge about lua, it’s syntax, it’s underlying paradigm and, how to organize data for computational purposes.

Reference:

Theory: