[CODE]ITEM.Name = "25+ Health"
ITEM.Enabled = true
ITEM.Description = "Gives you 25 more health."
ITEM.Price = 1000
ITEM.Model = "models/props_combine/health_charger001.mdl"
ITEM.SingleUse = false
ITEM.Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,
OnTake = function(ply, item)
if ply:Health() > 100 then
ply:SetHealth(ply:Health() - 100)
end
end
}
ITEM.Hooks = {
PlayerSpawn = function(ply, item)
ply:SetHealth(ply:Health() + 100)
end
}[/CODE]
Its not even working D:
Help me ?
This is useless, what's the issue? I can't find the issue if you don't tell me what's wrong, and don't tell me "it just doesn't work" because that won't help me at all.
[QUOTE=Reyjr43;44014449]This is useless, what's the issue? I can't find the issue if you don't tell me what's wrong, and don't tell me "it just doesn't work" because that won't help me at all.[/QUOTE]
it doesnt give them +25 health im running TTT gamemode 2
That's some butchered code right there. Try this:
[code]ITEM.Name = 'Health Boost'
ITEM.Price = 1
ITEM.Material = 'something'
ITEM.NoPreview = true
function ITEM:OnEquip(ply)
ply:SetHealth(ply:Health() + 25)
end
function ITEM:OnHolster(ply)
ply:SetHealth(ply:Health() - 25)
end[/code]
[QUOTE=code_gs;44024894]That's some butchered code right there. Try this:
[code]ITEM.Name = 'Health Boost'
ITEM.Price = 1
ITEM.Material = 'something'
ITEM.NoPreview = true
function ITEM:OnEquip(ply)
ply:SetHealth(150)
end
function ITEM:OnHolster(ply)
ply:SetHealth(100)
end[/code][/QUOTE]
That's a good way to let players exploit that item.
[QUOTE=brandonj4;44025161]That's a good way to let players exploit that item.[/QUOTE]
How so, your letting them purchase a single use item that sets your health to 150... I don't see that being a problem.
[QUOTE=Richtofen;44025237]How so, your letting them purchase a single use item that sets your health to 150... I don't see that being a problem.[/QUOTE]
There is no single use variable in his item.
If they have 1 hp and they holster the item, they have 100 hp again.
[QUOTE=brandonj4;44025161]That's a good way to let players exploit that item.[/QUOTE]
You're right; fixed the code.
[QUOTE=code_gs;44025394]You're right; fixed the code.[/QUOTE]
Missing "()" on "ply:Health"
I wouldn't do it that way but that's just a simple version but not a completely exploit free item.
A player could equip the item and if he goes down to 75 hp at one point, and he holsters, heals up again, then equips.
[QUOTE=brandonj4;44025437]Missing "()" on "ply:Health"
I wouldn't do it that way but that's just a simple version but not a completely exploit free item.
A player could equip the item and if he goes down to 75 hp at one point, and he holsters, heals up again, then equips.[/QUOTE]
Thanks; I really need to stop doing these on my phone.
And it totally depends on the gamemode.
I need it to make it every round they have it..
[QUOTE=log404;44033023]I need it to make it every round they have it..[/QUOTE]
Use the TTTBeginRound hook to give the health at the beginning of the round then.
[CODE]ITEM.Name = '125 HP'
ITEM.Price = 250000
ITEM.Material = 'something'
ITEM.NoPreview = true
ITEM.SingleUse = false
function ITEM:OnEquip(ply, modifications)
hook.Add("TTTBeginRound", "SetHP", function()
ply:SetHealth(ply:Health() + 25)
hook.Remove("TTTBeginRound", "SetHP")
end)
end
function ITEM:OnHolster(ply)
hook.Remove("TTTBeginRound", "SetHP")
end
function ITEM:OnSell(ply)
hook.Remove("TTTBeginRound", "SetHP")
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.