Simple name reference code

Hey guys !

I know this is quite simple but I can’t remember the code for it. I have a auto shout system which types lines in the chatbox by the press of a key.

example - Get down on the ground!

Now I am looking if it is possible for the code to include the player I am looking at name at the end ?

So it would say - “Get down on the ground Holmenlund!” if I was looking at myself… I can’t remember how to link this up, thanks in advance for the help !

Regards
Holmenlund

Sure, player:GetEyeTrace().Entity.

player is you.
Entity is the entity you are looking at, make sure to account for non players and invalid entities.

GetNick() will give you the name.

Thanks robotboy for the fast reply ! But sorry to tell I am quite unexperienced with LUA, can you tell me / show me how the code should look ? Here is the code atm :


--What messages should be spoken by the player, when they shout, whilst the target is running? (Only if SurrenderSettings["forcesurrender"] is set to true)
SurrenderSettings["forcesurrender_messages_running"] = {
"POLICE - Dont move!)",
"POLICE - Hold it!",
"POLICE - DONT move",
"POLICE - Stop running!",
"<Press Shift+ctrl+e> to surrender!",
"POLICE - Hold it right there!"
}


I am still learning so thanks in advance m8 ^^

Regards

[editline]24th August 2015[/editline]

Nvm I solved it ! Thanks for the help though :slight_smile: !