PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
new g_iMaxPlayers;
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
new g_bit_isSpecial;
#define MarkUserIsSpecial(%0) g_bit_isSpecial |= (1<<(%0&31))
#define ClearUserIsSpecial(%0) g_bit_isSpecial &= ~(1<<(%0&31))
#define UserIsSpecial(%0) g_bit_isSpecial & (1<<(%0&31))
new g_iSpecialTeamCheck;
new HamHook:g_iHhPlayerKilledPost;
new get_Cvar[ 3 ];
enum
{
SPECIAL_KILL,
MONEY_BONUS,
FRAG_BONUS
}
public plugin_init() {
register_plugin( "Special Kill", "1.0", "Pastout!" );
g_iMaxPlayers = get_maxplayers();
g_iHhPlayerKilledPost = RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed", .Post = true );
DisableHamForward( g_iHhPlayerKilledPost );
register_clcmd( "cs_vip", "R_VIP", ADMIN_BAN, "VIP Round Has Been Started!!!" )
}
// vip round
public R_VIP( ) {
EnableHamForward( g_iHhPlayerKilledPost );
g_iSpecialTeamCheck = 0;
GetRandomPlayer( "TERRORIST" );
}
GetRandomPlayer( TEAM[] ) {
new iPlayers[ 32 ], iNum, iPlayer;
get_players( iPlayers, iNum, "ae", TEAM );
for( new i = 0; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
resetPlayer( iPlayer );
}
iNum >= get_Cvar[ SPECIAL_KILL ] ? SetSpecialPlayer( iPlayers[ random( iNum ) ] ) : g_iSpecialTeamCheck++;
if( g_iSpecialTeamCheck == 1 )
{
for( new i = 0; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
resetPlayer( iPlayer );
}
DisableHamForward( g_iHhPlayerKilledPost );
}
}
resetPlayer( id ) {
if( UserIsSpecial( id ) )
{
cs_reset_user_model(id)
ClearUserIsSpecial( id );
}
}
SetSpecialPlayer( id ) {
MarkUserIsSpecial( id );
new szName[32];
get_user_name(id, szName, charsmax(szName));
client_print_color(0, GREY, "^4[CS]^3 %s^1 is now a^4 VIP" ,szName);
cs_set_user_model(id, "vip")
set_hudmessage(212, 0, 177, -1.0, 0.28, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s is now a VIP !!!", szName)
strip_user_weapons(id)
give_item(id, "weapon_deagle")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_knife")
cs_set_user_bpammo(id,CSW_DEAGLE,21)
set_user_health(id, 250)
set_user_armor(id, 200)
}
public Ham_CBasePlayer_Killed(id, iVictim, iKiller ) {
if( IsPlayer( iKiller )
&& UserIsSpecial( iVictim ) )
{
cs_set_user_money( iKiller, cs_get_user_money( iKiller ) + get_Cvar[ MONEY_BONUS ] );
set_user_frags( iKiller, get_user_frags( iKiller ) + get_Cvar[ FRAG_BONUS ] );
new szName[32];
get_user_name(iKiller, szName, charsmax(szName));
client_print_color(0, GREY, "^4[CS]^3 %s^1 killed^4 VIP" ,szName);
/////////////////////////
new iPlayer[32], iNum
get_players(iPlayer, iNum)
for(new i; i < iNum; i++) {
if(cs_get_user_team(iPlayer[i]) == CS_TEAM_T)
user_kill(iPlayer[i])
}
/////////////////////////
g_iSpecialTeamCheck++
if( g_iSpecialTeamCheck == 1 )
{
DisableHamForward( g_iHhPlayerKilledPost );
}
}
}
stock client_print_color(const id,const input[], any:...)
{
new msg[191], players[32], count = 1; vformat(msg,190,input,3);
replace_all(msg,190,"/g","^4"); // green
replace_all(msg,190,"/y","^1"); // normal
replace_all(msg,190,"/t","^3"); // team
if (id) players[0] = id; else get_players(players,count,"ch");
for (new i=0;i<count;i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}