CS2D
Scripts
LUA: Get a player's current clip and ammo?
LUA: Get a player's current clip and ammo?
1 reply How can I in lua, get ammo in current clip, and ammo in "backpack" for the weapon the player is currently holding?
Guess its something like player(id,"something") but cant find something like that in manual.
Tried with player(id,"reloading") but that was apparently a boolean value and not ammo. DC Admin
Offline
you actually can't get those values because the server isn't aware of the accurate ammo values.
the server only knows the maximum possible ammo amount a player still can have (based on the shoot-packets that arrived at the server) but the actual ammo value can differ (be slightly lower) in case a shoot-packet got lost. that's why these values are not revealed to the Lua scripting interface.
(in case a weapon is dropped the client determines the ammo which is in the dropped weapon. the server just checks if this value is lower or equal to the maximum possible ammo to make ammo hacks impossible)