Welcome everyone! Today I release another one of my scripts.
I made ammo system which was inspired by some random servers. I asked them for the script but they didn’t give it to me so I decided to create my own version of it which I want to share with you!
not many but some.
Features:
-Separated ammo types for different types of guns!
-Easy to change and add things script!
-I always offer my help below!
Dependencies:
es_extended(obviously). Im using limit system just so you know
And that’s all!
I won’t post any pictures or anything. because It just removes ammo when you shoot a gun. I also tried to make it use as little resources as It could. It shouldn’t crash server or anything(I think…). So yeah. Enjoy!
And I will add that I will be updating later or if someone gives me an idea what could be better! (and yes I will be adding configs. and maybe some translations later on)
Update 1.0
-Changed a little bit how the setting ammo works(on GetHashKey and if you are holding a gun, not every server event there is)
-Slightly reduced the event overflow(if someone would ever get this)
I will add that I tested this script on more than just localhost. And server wasn’t doomed. And it only triggers when you are holding weapon. Its needed because well, I don’t know any other method for counting how many bullets you have in your inventory. And also Citizen.Wait(100) is because as I said to use as little resources as possible. I will be adding something like GetHashKey for it to be just triggering server event when you are holding one weapon and not all of them.
Edit: I updated script. Its using less server events and If you are holding a type of gun that is defined in setammo. Server is not going to crash. Just don’t touch any Citizen.Wait(100). or else you can get event overflow. Change them to higher values if you want tho!
Don’t use script then. If 100 players have guns then well. You have good community there (I know its example, but still. Kinda shitty one.) You can change these numbers if you want. Bigger server can get other script or make it themselfs. Or just don’t use it. And it’s better if you have 10 events per second than 1000. Don’t you think? And you can add something like IfIsPedShooting after every if weapon==[…] so yeah. And if you have better solution then be my guest and tell me or just send here example of how would you solve it
One thing that comes with scripts back few years is that they don’t really work on newer implementations of frameworks.
This script has been made for at most ESX V1 Final, where scripts were lacking.
I suggest you look at newer implementations of ammo system, or check out OX.
Sorry that I can’t help you. Most probably you have a resource/s that are blocking native functions(or overriding their result) which is common in post 2022 framework releases.