English Limit grenade ammount -- request

4 replies
Goto Page
To the start Previous 1 Next To the start
Up
mrc
User
Offline Off
How to not allow players to have or buy more than 4 grenades?
CS2DBR Community - http://cs2dbr.tk
13.08.20 07:38:16 pm
Up
TimeQuesT
User
Offline Off
I do not know if it is possible with vanilla means but it is definitely achievable with lua.
I used cs2d lua cmd playerweapons, which I do not know if it recognizes two flashbangs.

Untested code example >


Better copy that code into an editor that supports HL. This montone green text is unreadable.
Muh
15.08.20 07:28:55 pm
Up
mrc
User
Offline Off
ye, with flashbang it doesnt work properly

I made 1 flashbang per player and now its ok
edited 1×, last 15.08.20 11:36:39 pm
CS2DBR Community - http://cs2dbr.tk
16.08.20 10:09:44 am
Up
TimeQuesT
User
Offline Off
-------------------------------------------------------------
× do not use
-------------------------------------------------------------
Another way would be counting the grenades on certain events.

cs2d lua hook buy and cs2d lua hook walkover for increasing.
(cs2d lua hook attack / cs2d lua hook projectile), cs2d lua hook drop and cs2d lua hook die for decreasing.


-------------------------------------------------------------
√ use this
-------------------------------------------------------------
Edit: Okay it is much easier than expected.
You can use cs2d lua cmd playerammo to retrieve the amount of flashbangs carried.

the function p_count_grenades changes minorly by replacing
+ 1
with
+ playerammo(p_id, item_id);


Changed function >
edited 2×, last 16.08.20 05:07:40 pm
Muh
16.08.20 06:32:44 pm
Up
mrc
User
Offline Off
I didnt tested yet but this might work, I totally forgot about the playerammo.
CS2DBR Community - http://cs2dbr.tk
To the start Previous 1 Next To the start