• SetHealth not working?
    4 replies, posted
Hi guys, I'm new to garrysmod development and I have recently been trying to create my own gamemode but have been stuck on one issue... my SetHealth doesn't seem to SetHealth, no matter what I put the health just stays solid at 100, any ideas? every other variable works (run speed etc) [CODE]function GM:PlayerSpawn( ply ) if ply:Team()== 1 then ply:Give( "Knife" ) ply:SetGravity ( 2 ) ply:SetWalkSpeed( 10 ) ply:SetRunSpeed( 10 ) ply:SetMaxHealth( 1000 ) ply:SetHealth( 120 ) end[/CODE]
ply ply ply ply ply Entity????????????????? The player (ply) is an entity. I don't see why ply:SetHealth( amount ) wouldn't work.
Yeah, it'd work fine; what made you want to do Entity instead of ply?
Oh I've tried ply and many other ways, it just so happened that entity was the last thing I tried But yea I have it up on a server right now and the health amount just doesn't change! I don't understand why, could it be a visual bug? [IMG]http://i.imgur.com/SUjlJ2I.jpg[/IMG]
4 years to late...Try setting a simple timer on it. timer.Simple(1, function() ply:SetHealth(300) end) This was the solution for me.
Sorry, you need to Log In to post a reply to this thread.