How to add more Health to a player that has already 20 hp
6 replies, posted
I wonder how to get this work?
if a player has 20 hp and i want to add 50 extra hp into 20 so it be 70hp how todo that?
The example on the wiki shows the following;
Entity( 1 ):SetHealth( Entity( 1 ):Health() - 50 )
which removes 50 health from the current health - so for your example edit the code I provided to suit your problem!
local ply = FindMetaPlayer( "Player" )
ply:SetHealth( ply:Health() + 50 )
Don't you have algebra in school?
Entity/SetMaxHealth
Entity/SetHealth
Learn lua.
Well thats is what i'm trying todo, wiki dosen't learn everything better to ask and not asking at all and not learning dumb...
Wiki doesn't tell you how to program, it tells you what functions there are and how to use them.
You need to learn basic coding skills.
You need to learn the file structure and how gmod loads files.
The forum have had experiences with people refusing to learn Lua, and kept asking to be spoon-feed. Some even spammed the forums with simple questions like; "Will this run?".
Its best to try it out yourself, look for tutorials on youtube or look in addons and see what makes them tick.
Even if you're unsure or your code fails to load. Its best to try before asking.
Coding takes time and patience, you can't just learn it overnight. If you want to code, watch this tutorial series and learn yourself. I won't spoonfeed, neigher will most people.
Sorry, you need to Log In to post a reply to this thread.