As you're probably about to see, I'm fairly new to Lua. I've been trying to put together a swep that says that if the weapon is deployed, then a second after jumping, lower the gravity.
So far I have this monstrosity:
[lua]function SWEP:ChangeGrav (self, IN_JUMP)
self.Owner:SetGravity(-1)
print("Working")
end
hook.Add( "KeyPress", "KeyPressedHook", ChangeGrav )
function SWEP:Deploy()
timer.Create( "SetGrav", 1, 0, ChangeGrav )
end[/lua]
that produces this error:
[code]
[ERROR] lua/weapons/weapon_parachute/shared.lua:49: bad argument #4 to 'Create' (function expected, got nil)
1. Create - [C]:-1
2. unknown - lua/weapons/weapon_parachute/shared.lua:49
[/code]
I don't know where I've gone wrong since I have very basic lua knowledge but I'd be very grateful for any help :P
[QUOTE=godred2;47412648][url]http://wiki.garrysmod.com/page/timer/Simple[/url]
[url]http://wiki.garrysmod.com/page/timer/Create[/url][/QUOTE]
The timer seems to be fine, I'd assume there was an error with the function/hook
Sorry, you need to Log In to post a reply to this thread.