[REAPI] Restricting items from being bought/picked up

DusT

Administrator
Staff member
Administrator
Messages
42
Reaction score
21
Points
77
Let's say I want to make a VIP Plugin where only VIPs can buy snipers.
Without reapi, this meant registering each awp name as a command and write PLUGIN_HANDLED to block it from being bought.
PHP:
Please, Log in or Register to view codes content!

Another missing thing from restricting AWPs to non-vips is to block them from getting dropped snipers. This, again without reapi, is usually done by hooking Ham_Touch to armoury_entity and weaponbox and then check if the weapon's classname is one of the snipers' ones.
PHP:
Please, Log in or Register to view codes content!

Reapi solves all this mess with a simple hook: RG_CBasePlayer_HasRestrictItem. Here's the code to both block picking up and buying snipers.
PHP:
Please, Log in or Register to view codes content!

The code, at least to me, is much simplier and less hacky.
Other usages would be when you want some gun to be picked up only by certain groups: for example make a gun pickable only by CTs.
 
Top Bottom