Hello I made a health potion with this script an I want to add a health regen effect onto it what would I put in my code?, sorry, new to Gmod Lua,
[CODE] items["health_potion"] = {
name = "Health potion",
desc = " Use this to raise your health when you are low on HP",
ent = "item_basic",
prices = {
buy = 10,
sell = 5
},
model = "models/items/provisions/potions/life_potion.mdl",
use = (function(ply, ent)
if ply:IsValid() then
ply:AddHealth( 2 )
if ent then
ent:Remove()
end
end
end),
spawn = (function(ply, ent)
ent:SetItemName( "healthpotion" )
end),
skin = 0,
buttonDist= 32,
} [/CODE]
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/Create]timer.Create[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/Destroy]timer.Destroy[/url], and ply:SetHealth(ply:Health()+amt), replace amt with health given.
Is there a way I can set the timer to go for a certain amount of time
timer.Create accepts a seconds parameter that lasts however long you want to.
Sorry, you need to Log In to post a reply to this thread.