Forum

> > CS2D > Scripts > LUA: Get a player's current clip and ammo?
Forums overviewCS2D overview Scripts overviewLog in to reply

English LUA: Get a player's current clip and ammo?

1 reply
To the start Previous 1 Next To the start

old LUA: Get a player's current clip and ammo?

sebastiannielsen
User Off Offline

Quote
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.

old Re: LUA: Get a player's current clip and ammo?

DC
Admin Off Offline

Quote
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)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview