Hi there, I would like to make it so even if a person buys health they may not go over the health limit of 100.
[CODE]function BuyHealth25(ply)
if not ply:CanAfford(50) then
Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, "25 health"))
return ""
end
if ply.StartHealth and ply:Health() >= ply.StartHealth then
Notify(ply, 1, 4, string.format(LANGUAGE.unable, "buy 25 health", ""))
return ""
end
ply.StartHealth = ply.StartHealth or 100
ply:AddMoney(-50)
Notify(ply, 0, 4, string.format(LANGUAGE.you_bought_x, "health", CUR .. tostring(50)))
ply:SetHealth(ply:Health() + 25)
end
concommand.Add("buy_health25", BuyHealth25)[/CODE]
This code makes it so it adds 25 hp to your current health I would like it so if its 99 hp and you buy 25 hp it wont go to 124hp.
Close wrong section.
Sorry, you need to Log In to post a reply to this thread.