Hi there, so this is the code I am currently using for a double jump pointshop addon.
ITEM.Name = "Double Jump"
ITEM.Enabled = true
ITEM.Description = "Allows you to jump twice!"
ITEM.Price = 10000
ITEM.Model = "models/passtime/flasks/flask_bottle_red.mdl"
ITEM.SingleUse = false
local function doublejump(ply, key)
if key == IN_JUMP then
if !ply:IsOnGround() then
if ply.FirstJump == 1 then
ply:SetVelocity(Vector(0,0,200) + Vector(0,0,-1*ply:GetVelocity().z))
ply.FirstJump = 0
end
else
ply.FirstJump = 1
end
end
end
hook.Add("KeyPress", "doublejump", doublejump)
Unfortunately while this is on the server, everyone can double jump regardless of whether or not they own the power up. Any help would be appreciated. Thanks in advance :)
You need to check if they have the item in the KeyPress hook.
Thanks for the response. Assuming it does, how would one go from there?
Change your check to something like the following:
[CODE]
if key == IN_JUMP and ply:PS_HasItem('insert item name here') then
[/CODE]
Thank you very much. It worked :)
Sorry, you need to Log In to post a reply to this thread.