I wasn’t sure where exactly to post it or if it warranted it’s own thread so yeah just tell me to delete if this is inappropriate. I’m new to both facepunch and lua and I hope I’m not doing any wrong here.
Anyway, I’m trying to create a simple lua file for \autorun\server that damages all players every X seconds (currently set to 3 for testing purposes) to simulate hazardous environments or hunger without actually using DarkRP.
Now, I have no experience actually coding prior to this. I’ve managed to somehow piece together some code (probably with lots of useless parts):
for k,v in pairs(player.GetHumans()) do
This actually seems to work (though I can’t test it out in multiplayer to see if it really affects all players) but it makes the view-shake effect upon damage, which would be highly distracting to gameplay and generally unfitting. Is there any way to negate this, or will I have to find a more complex workaround, such as setting all players’ health to their health minus one and then checking to see if their health is 0, in which case it kills them? (Apparently health can go to 0 without the player actually dying if it’s not caused by actual damage.)
I tried to find something in the garrysmod wiki about that sort of thing, but to no avail.
Again, I apologize if this is a noob question and doesn’t belong here. I would try to learn more, but this seems like a simple thing to do, from my limited understanding, so I hoped someone could give me a little tip. :huh: