PHP Code:
const PRIMARY_WEAPONS = ( 1 << CSW_AK47 ) | ( 1 << CSW_M4A1 ) | ( 1 << CSW_FAMAS ) | ( 1 << CSW_GALIL ) | ( 1 << CSW_SCOUT ) | ( 1 << CSW_AWP ) | ( 1 << CSW_M249 ) | ( 1 << CSW_MP5NAVY ) | ( 1 << CSW_P90 ) | ( 1 << CSW_MAC10 ) | ( 1 << CSW_TMP ) | ( 1 << CSW_XM1014 ) | ( 1 << CSW_M3 ) | ( 1 << CSW_G3SG1 ) | ( 1 << CSW_SG550 ) | ( 1 << CSW_SG552 ) | ( 1 << CSW_AUG ) | ( 1 << CSW_UMP45 );
new bool: g_bHasPrimary[ 33 ];
public client_putinserver(id)
g_bHasPrimary[ id ] = false;
public Event_CurWeapon(id)
{
// register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );
g_bHasPrimary[ id ] = false;
static iWeapons[ 32 ], iNum, i; iNum = 0;
get_user_weapons( id, iWeapons, iNum );
for( i = 0; i < iNum; i++ )
{
if( ( 1 << iWeapons[ i ] ) & PRIMARY_WEAPONS )
{
g_bHasPrimary[ id ] = true;
break;
}
}
}
public Event_DeathMsg()
{
new iKiller = read_data(1);
new iVictim = read_data(2);
new freekill_slay = get_pcvar_num(jb_slay_4freekills)
new max_freekills = get_pcvar_num(jb_max_freekills);
new szVName[32], szKName[32];
get_user_name(iVictim, szVName, charsmax(szVName));
get_user_name(iKiller, szKName, charsmax(szKName));
clear_bit(g_bIsAlive, iVictim);
if( cs_get_user_team( iVictim ) == CS_TEAM_T )
{
if( IsPlayer( iKiller ) && cs_get_user_team( iKiller ) == CS_TEAM_CT )
{
if( g_bRebel[iVictim] )
{
fnColorPrint(0, "Guard^4 %s ^1killed rebel^4 %s ^1!", szKName, szVName);
}
else if( !g_bRebel[iVictim] )
{
if( g_bHasPrimary[ iVictim ] ) return PLUGIN_HANDLED;
g_iFreekill[iKiller]++
if(g_iFreekill[iKiller] == 1)
{
fnColorPrint(iKiller, "^3Warning: ^1Freekilling is not allowed. ");
UTIL_ScreenFade(iKiller,{ 255, 100, 61 }, 2.0, 2.0, 85);
}
if(g_iFreekill[iKiller] == 2)
{
UTIL_ScreenFade(iKiller,{ 255, 100, 61 }, 2.5, 2.5, 95);
}
if(g_iFreekill[iKiller] == freekill_slay)
{
fnColorPrint(iKiller, "^3Last warning:^1 Every freekill you make form now will result in instant slay");
UTIL_ScreenFade(iKiller,{ 255, 0, 0 }, 2.5, 2.5, 175);
}
if(g_iFreekill[iKiller] >= max_freekills)
{
//client_tutor(0, TutorRed, FriendDied, 6.0, "Freekilling is not allowed,^nType rules to see the rules.");
UTIL_ScreenFade(iKiller,{ 255, 0, 0 }, 2.5, 2.5, 255);
user_kill(iKiller);
}
}
}
}
return PLUGIN_HANDLED;
}