If you are planning on adding restrictions for other weapons let me know.
Edit: Updated code using cstrike module instead of fakemeta
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#define FLAG_ALLOW ADMIN_LEVEL_H
public plugin_init()
{
register_plugin( "Block AWP Purchase" , "0.1" , "bugsy" );
RegisterHam( Ham_AddPlayerItem ,"player" ,"fw_AddPlayerItem" );
}
public fw_AddPlayerItem( iPlayer , iItem )
{
if ( get_user_flags( iPlayer ) & FLAG_ALLOW )
return HAM_IGNORED;
if ( cs_get_weapon_id( iItem ) == CSW_AWP )
{
set_task( 0.15 , "ReimburseMoney" , iPlayer );
client_print( iPlayer , print_chat , "* You are restricted from using AWP!" );
SetHamReturnInteger( 1 );
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public ReimburseMoney( id )
{
cs_set_user_money( id , clamp( ( cs_get_user_money( id ) + 4750 ) , 4750 , 16000 ) , 1 );
}
__________________