jotaveqz Posted February 5, 2025 Posted February 5, 2025 On Tactics servers, weapons automatically reload when changing weapons, and I wanted a script that would do this can anyone help me?
xMKHx Posted February 6, 2025 Posted February 6, 2025 Client-Side: -- Function to check ammo and reload function checkAmmoAndReload() -- Get the player's current weapon local weapon = getPedWeapon(localPlayer) -- Get the ammo in the player's clip local ammoInClip = getPedAmmoInClip(localPlayer) -- Get the total ammo the player has for the current weapon local totalAmmo = getPedTotalAmmo(localPlayer) -- If the clip is empty but the player has more ammo, reload the weapon if ammoInClip == 0 and totalAmmo > 0 then triggerServerEvent("onPlayerReloadWeapon", localPlayer) end end -- Event handler for when the player fires a weapon addEventHandler("onClientPlayerWeaponFire", localPlayer, checkAmmoAndReload) Server-Side: -- Event to handle weapon reloading addEvent("onPlayerReloadWeapon", true) addEventHandler("onPlayerReloadWeapon", root, function() -- Get the player's current weapon local weapon = getPedWeapon(source) -- Reload the weapon setPedWeaponSlot(source, getPedWeaponSlot(source)) end) I don't know if it's working, I just asked DeepSeek and this is the result.. Have fun UDC:RPG Owner 13 Years Experience ______________________________________ Spoiler - ATM Robbery Script. - Police Shield Script - Army Animations Script - Criminal Skills Script - Drop Weapons Script
Moderators IIYAMA Posted February 9, 2025 Moderators Posted February 9, 2025 setGlitchEnabled("quickreload", true) https://wiki.multitheftauto.com/wiki/SetGlitchEnabled You could the enable the quickreload glitch. For testing: /start runcode /srun setGlitchEnabled("quickreload", true) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now