#include amxmodx
#include hamsandwich
#include fun
#include cstrike
#include fakemeta
new const P_INFO[ ][ ] = { "Random Weapons", "1.0", "kikizon" };
enum _:WPNDATA { WPN_ENT[ 30 ], WPN_CSW }
new const PrimWeapons[ ][ WPNDATA ] =
{
{ "weapon_mp5navy", CSW_MP5NAVY },
{ "weapon_scout", CSW_SCOUT },
{ "weapon_ak47", CSW_AK47 },
{ "weapon_aug", CSW_AUG },
{ "weapon_awp", CSW_AWP },
{ "weapon_famas", CSW_FAMAS },
{ "weapon_g3sg1", CSW_G3SG1 },
{ "weapon_galil", CSW_GALIL },
{ "weapon_m249", CSW_M249 },
{ "weapon_m3", CSW_M3 },
{ "weapon_m4a1", CSW_M4A1 },
{ "weapon_mac10", CSW_MAC10 },
{ "weapon_p90", CSW_P90 },
{ "weapon_sg550", CSW_SG550 },
{ "weapon_sg552", CSW_SG552 },
{ "weapon_tmp", CSW_TMP },
{ "weapon_ump45", CSW_UMP45 },
{ "weapon_xm1014", CSW_XM1014 }
}
new const SecWeapons[ ][ WPNDATA ] =
{
{ "weapon_deagle", CSW_DEAGLE },
{ "weapon_elite", CSW_ELITE },
{ "weapon_fiveseven", CSW_FIVESEVEN },
{ "weapon_glock18", CSW_GLOCK18 },
{ "weapon_p228", CSW_P228 },
{ "weapon_usp", CSW_USP }
};
new kPrimary[ 33 ], kSecondary[ 33 ], cvar_blockbuy;
public plugin_init()
{
register_plugin( P_INFO[ 0 ], P_INFO[ 1 ], P_INFO[ 2 ] );
RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawnPost", true );
cvar_blockbuy = register_cvar( "rw_blockbuy", "1" );
if( get_pcvar_num( cvar_blockbuy ) == 1 )
register_message(get_user_msgid("StatusIcon"), "message_statusicon");
}
public client_putinserver( index ) kPrimary[ index ] = kSecondary[ index ] = 0;
public ham_PlayerSpawnPost( index )
{
set_task(2.0, "give_weapons", index)
}
public client_disconnect(id)
remove_task(id)
public give_weapons(index)
{
if( !is_user_alive( index )) return;
strip_user_weapons( index );
give_item( index, "weapon_knife" );
kPrimary[ index ] = random_num( 0, charsmax(PrimWeapons));
kSecondary[ index ] = random_num( 0, charsmax(SecWeapons));
give_item( index, PrimWeapons[ kPrimary[index] ][ WPN_ENT ] );
give_item( index, SecWeapons[ kSecondary[index] ][ WPN_ENT ] );
cs_set_user_bpammo( index, PrimWeapons[ kPrimary[index] ][ WPN_CSW ], 999 );
cs_set_user_bpammo( index, SecWeapons[ kSecondary[index] ][ WPN_CSW ], 999 );
}
public message_statusicon(msg_id, msg_dest, index)
{
static szIcon[8];
get_msg_arg_string(2, szIcon, charsmax(szIcon));
if (equal(szIcon, "buyzone") && get_msg_arg_int(1))
{
set_pdata_int(index, 235, get_pdata_int(index, 235) & ~(1<<0));
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}