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.
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]:-
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.
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:https://gyazo.com/00c69cef3bfca755bab171b3cb58e19b
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: https://gyazo.com/ce20c44c1dd572e8505af103807f529b (this last one is only a draw.RoundedBox
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
Lerp 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 YuRaNnNzZZ!
Thanks for this.