[FREE] [Standalone] Simple Infinite Ammo

A simple Infinite Ammo Scirpt for anyone who need it.

infiniteW2

Just follow the steps on Github:

Command Guide:

  • Enable InfiniteAmmo for the whole server: /infiniteOn
  • Disable InfiniteAmmo for the whole server: /infiniteOff
  • Enable InfiniteAmmo for a specific WeaponHash: /infiniteOnFor [YourWeaponHash]
  • Disable InfiniteAmmo for a specific WeaponHash: /infiniteOffFor [YourWeaponHash]
Code is accessible Yes
Subscription-based No
Lines (approximately) 100 Lua
Requirements No Requirements
Support Yes
5 Likes

i award you my love, because you made a standalone resource for fivem. thank you

2 Likes

how is this even a release?

Because it has code in it? Because they posted it to the forums? not that hard to be honest.

5 Likes

Useful stuff!

1 Like

Some of owners need this.
I think this is useful.

1 Like

Usefull for some people. But if i am correct you are creating Threads without stopping them and every time a command is entered you create another one without stopping the old ones.

I think it is not a big problem but I try to insert that the thread will be stopped.
The branch will be available on github soon

it can lead to a big problem a script looping through a native that runs like 220 times every tick and that stacks every time the command is run, that is already quite a lot after running it like 8 times.

Oh and a Tip for the future you should use PlayerPedId() instead of GetPlayerPed(-1)
and also use PlayerId() instead of GetPlayerServerId(playerPed)

okay thanks I will change in the future :smiley:

1 Like

You are Welcome and thanks for sharing something for free to the community :slight_smile:

1 Like

nice simple resources GG

2 Likes

Just FYI the PlayerPedId() or GetPlayerPed(-1) changes whenever you change your ped model. This will cause the resource to not work, when you are referring to the old ped.

Solution: Call PlayerPedId() within the function it needs the player ped.

1 Like

You may want to build a server.lua because the client side script will only affect the single client who uses it. That way it will work as expected.

To kind of summarize:

  1. Client.lua calls an event in server.lua, example: TriggerServerEvent('infiniteammo:server:toggleServer') (this command should be protected by ACE permissions so only admins can use it)
  2. toggleServer event checks updates a variable to true/false and sends that back to all clients via another receiving event in client.lua
  3. Add a check for player’s joining to grab the current state (another simple event could do this) when they join to ensure they match the current state for infinite ammo

I just noticed and figured I’d point that out since you have the server wide command in the readme. Cheers! :slight_smile:

2 Likes

Changed it already

I can try to do it

Updated it, is that what you meant?

No. I still see that you only call PlayerPedId once. As I said, this will result in an “error” whenever the player changes model. Therefore you need to call the ped whenever you run the command.

Example?

I created a pull request with all changes needed.

1 Like