Server LUA files

So my friends and I play on a server via hamachi, and I want to set it so that when they join the game we can’t see each other’s player IDs and health. Per this thread: I copied that code into a lua file and placed it in lua/autorun/server. However when I started up the server I got an error about how it attempted to call GM, which is a nil value. No idea what this means as I have no experience with LUA, though my gut instinct is there should be a pretty simple fix.

Any help would be greatly appreciated, I just want to turn of the player ID/health on aim for me and my friends.


That code is to be used for gamemodes ( lua files inside gamemodes/*/gamemode/ )

In your case, you gotta use hook.Add:

hook.Add("HUDDrawTargetID","myhook", function() return false end)

So I replaced the file I had with this code, but it still didn’t work. I start the server by just starting a game on a map through the main menu interface and then setting the number of players to four instead of single, then they just connect to my IP. Should it still work? I’m not sure if this actually counts as a server.

Also the software I use to edit lua files is textwrangler

You gotta put the script into lua/autorun/client.

Perfect, thank you!

[editline]14th June 2014[/editline]

Now no one can damage each other though. Godmode is set to 0 and players hurt players is set to 1. Is this a result of the code, or something I’m missing? Thanks a ton for the help with this, sorry I’m not super competent.

Also we use (what I assume to be) your lightsaber mod. It’s really cool!

No, it cannot be caused by that one line of code I posted.

Okay, I’ll sort it then. Thank you for helping out!