• Temporary TimeScale?
    2 replies, posted
Im making a SWEP and was wondering if theres a way to do this: Whenever you Hold the Reload button, it actives a function. and when you release the reload button, it starts a new function. For example: When holding reload, game.SetTimeScale(0.1) When releasing reload, game.SetTimeScale(1) Hope you can figure out a way ;) Best Regards, Author
The [URL="http://wiki.garrysmod.com/page/Player/KeyPressed"]player.KeyPressed[/URL] and [URL="http://wiki.garrysmod.com/page/Player/KeyDown"]player.KeyReleased[/URL] only call once, if the player hits or releases the key at that exact frame, meaning you could do something like this in your SENT:Think(): [lua] ply = self.Owner if ply:KeyPressed( IN_RELOAD ) then game.SetTimeScale( 0.1 ) elseif ply:KeyReleased( IN_RELOAD ) then game.SetTimeScale( 1 ) end [/lua]
Player:KeyPressed & Player:KeyReleased & Player:KeyDown IN_RELOAD as first argument SWEP:Think Can you figure it out? [editline]11th February 2014[/editline] Damn ninjas :v:
Sorry, you need to Log In to post a reply to this thread.