#include < amxmodx >
#include < cstrike >
#include < fun >
#include < hamsandwich >
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Dragos"
#define ACCESS ADMIN_LEVEL_H
#define is_user_vip(%1) (get_user_flags(%1) & ADMIN_LEVEL_H)
new he_spawn, flash_spawn, hp_kill, hp_hs, max_hp, money_hs, money_kill, MaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_Spawn, "player", "HamPlayerSpawnPost", 1 );
register_event( "DeathMsg", "event_DeathMsg", "a" );
he_spawn = register_cvar("he_spawn","1");
max_hp = register_cvar("max_hp", "200" );
flash_spawn = register_cvar("flash_spawn", "2" );
money_hs = register_cvar("hs_money","500");
money_kill = register_cvar("kill_money","200");
hp_hs = register_cvar("hs_hp","10");
hp_kill = register_cvar("kill_hp","5");
register_clcmd ( "say /vips", "cmdShow" );
MaxPlayers = get_maxplayers ( );
}
public HamPlayerSpawnPost( id )
{
if( is_user_alive( id ) && ( get_user_flags( id ) & ACCESS ) )
{
give_item ( id, "weapon_deagle" );
cs_set_user_bpammo ( id, CSW_DEAGLE, 35 );
give_item(id, "weapon_flashbang");
cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num( he_spawn ) );
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num( flash_spawn ) );
cs_set_user_armor ( id, 100, CS_ARMOR_VESTHELM );
if ( cs_get_user_team ( id ) == CS_TEAM_CT )
give_item ( id, "item_thighpack" );
}
}
public event_DeathMsg( )
{
new iAttacker = read_data( 1 );
new iVictim = read_data( 2 );
new iHeadshot = read_data( 3 );
new HealthOnHeadShot = get_pcvar_num( hp_hs );
new HealthOnKill = get_pcvar_num( hp_kill );
new MoneyOnHeadShot = get_pcvar_num( money_hs );
new MoneyOnKill = get_pcvar_num( money_kill );
new MaxHealth = get_pcvar_num( max_hp );
new CurrentHealth = get_user_health ( iAttacker );
if( iAttacker == iVictim )
return 0;
if( is_user_vip( iAttacker ) && iAttacker != iVictim )
{
if( get_user_health( iAttacker ) <= MaxHealth )
{
if( iHeadshot )
{
CurrentHealth += HealthOnHeadShot
if ( CurrentHealth > MaxHealth ) CurrentHealth = MaxHealth
set_user_health ( iAttacker, CurrentHealth );
cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + MoneyOnHeadShot );
}
else
{
CurrentHealth += HealthOnKill
if ( CurrentHealth > MaxHealth ) CurrentHealth = MaxHealth
set_user_health ( iAttacker, CurrentHealth );
cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + MoneyOnKill );
}
}
}
return 0;
}
public cmdShow ( player )
{
new VipName [33][32];
new message[256];
new id, count, x, len;
for ( id = 1 ; id <= MaxPlayers ; id++ )
if ( is_user_connected ( id ) && is_user_vip ( id ) )
get_user_name ( id, VipName [count++], 31 )
len = format(message, 255, "!gVIP`s Connected !n:!t" )
if(count > 0)
{
for(x = 0 ; x < count ; x++)
{
len += format(message[len], 255-len, " %s%s ", VipName [x], x < (count-1) ? "!n, !t":"")
if(len > 96 )
{
ColorChat ( player, "%s", message)
len = format ( message, 255, "" )
}
}
ColorChat ( player, "!t%s", message )
}
else
{
len += format ( message[len], 255-len, " !tNo VIP`s Connected !" )
ColorChat ( player, "%s", message )
}
}
stock ColorChat(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[320]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!n", "^1")
replace_all(msg, 190, "!t", "^3")
replace_all(msg, 190, "!t2", "^0")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players) )
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players)
write_string(msg)
message_end()
}
}
}
}