I wrote a small script that handles weapon switching binds, sounds, and drawing states for custom weapon switchers. Custom drawing code just needs to be placed in the DrawWeaponHUD function and the rest will be handled by the skeleton. Selection information like the current slot and weapons are instance variables to the file that are available to the drawing method. Time comparisons are all done with RealTime.
Code: [url]https://github.com/Kefta/Weapon-Switcher-Skeleton/blob/master/gs_switcher.lua[/url]
[code]addons/darkrpmodification-master/lua/darkrp_modules/miscshit/cl_switcher.lua:339: attempt to index a nil value
stack traceback:
addons/darkrpmodification-master/lua/darkrp_modules/miscshit/cl_switcher.lua:339: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
[C]: in function '•‎​‬‪•'
[ERROR]
1. unknown - [C]:-[/code]
-snip-
[QUOTE=Tomelyr;51841299]it's not an darkrp module[/QUOTE]
Any file that has cl_ in darkrp modules gets run clientside.
Doesn't matter if it's a darkrp module or not, It's just neatly organized.
[QUOTE=Sir Klutch;51841107][code]addons/darkrpmodification-master/lua/darkrp_modules/miscshit/cl_switcher.lua:339: attempt to index a nil value
stack traceback:
addons/darkrpmodification-master/lua/darkrp_modules/miscshit/cl_switcher.lua:339: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
[C]: in function '•‎​‬‪•'
[ERROR]
1. unknown - [C]:-[/code][/QUOTE]
Fixed, thank you
thank you so much for this skeleton, but i have a little problem. How do i make an animation? for example this is what i currently have:[url]https://gyazo.com/00c69cef3bfca755bab171b3cb58e19b[/url]
when i scroll the whole thing just pop up i want to add some black bar to each one to show wich one u scrolling at for example: [url]https://gyazo.com/ce20c44c1dd572e8505af103807f529b[/url] (this last one is only a draw.RoundedBox
[QUOTE=oliking021;52803467]thank you so much for this skeleton, but i have a little problem. How do i make an animation? for example this is what i currently have:[url]https://gyazo.com/00c69cef3bfca755bab171b3cb58e19b[/url]
when i scroll the whole thing just pop up i want to add some black bar to each one to show wich one u scrolling at for example: [url]https://gyazo.com/ce20c44c1dd572e8505af103807f529b[/url] (this last one is only a draw.RoundedBox[/QUOTE]
Interpolate your drawing. Instead of just drawing the box at the desired position, use the "flSelectTime" variable in the skeleton to progressively reach the desired position. You can use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Lerp]Lerp[/url] with the fraction being math.min(1, (RealTime() - flSelectTime) / ANIMATION_TIME)
Fixed invprev and invnext doing the reverse of their intended effect, the repo has been updated. Thanks [URL="https://facepunch.com/member.php?u=464298"]YuRaNnNzZZ[/URL]!
Thanks for this.
Sorry, you need to Log In to post a reply to this thread.