#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fakemeta_util >
#include < fun >
#define ADMIN_VIP ADMIN_LEVEL_H
static const PLUGIN[ ] = "VIP Options";
static const VERSION[ ] = "1.0";
static const COLOR[] = "^x04"; //green
new g_HudSyncObj;
new maxplayers;
new gmsgSayText;
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, "Unhask" );
register_clcmd( "say /vips","print_adminlist" );
register_clcmd( "say /vip", "ShowFile" );
register_event( "Damage", "Damage", "b", "2!0", "3=0", "4!0" );
register_event( "DeathMsg", "WhenDeadPlayer", "be" );
register_event( "HLTV", "NewRound", "a", "1=0", "2=0" );
register_message( get_user_msgid( "ScoreAttrib" ), "OnScoreboard" );
maxplayers = get_maxplayers();
gmsgSayText = get_user_msgid("SayText");
g_HudSyncObj = CreateHudSyncObj();
}
public client_connect( id )
{
new szName[ 32 ];
get_user_name( id, szName, sizeof ( szName ) - 1 );
chat_color( 0, "!gV.I.P %s has connected", szName );
}
public ShowFile( id ) show_motd( id, "addons/amxmodx/configs/vip.txt", "BUY VIP" );
public OnScoreboard( const MsgId, const MsgDest, const MsgRecevier )
{
new id = get_msg_arg_int( 1 );
if ( is_user_connected( id ) && get_user_flags( id ) & ADMIN_VIP )
{
set_msg_arg_int( 2, ARG_BYTE, is_user_alive( id ) ? ( 1<<2 ) : ( 1<<0 ) );
}
}
public NewRound( )
{
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum, "ac" );
for ( new g = 0; g <= iNum; g ++ )
{
if ( is_user_alive( iPlayers[ g ] ) && get_user_flags( iPlayers[ g ] ) & ADMIN_VIP )
{
give_item( iPlayers[ g ], "weapon_hegrenade" );
give_item( iPlayers[ g ], "weapon_flashbang" );
give_item( iPlayers[ g ], "weapon_flashbang" );
set_user_armor( iPlayers[ g ], 100 )
}
}
}
public WhenDeadPlayer( )
{
new szKiller = read_data( 1 );
new HeadShot = read_data( 3 )
if ( szKiller == read_data( 2 ) )
return 1;
if ( HeadShot )
cs_set_user_money( szKiller, cs_get_user_money( szKiller ) + 800 );
else
cs_set_user_money( szKiller, cs_get_user_money( szKiller ) + 500 );
return 0;
}
public Damage(id)
{
static Attacker;
Attacker = get_user_attacker(id);
if (get_user_flags(Attacker) & ADMIN_VIP)
{
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, 7);
ShowSyncHudMsg(Attacker, g_HudSyncObj, "%d^n", read_data(2));
}
}
public print_adminlist(user)
{
new adminnames[33][32]
new message[256]
new id, count, x, len
for(id = 1 ; id <= maxplayers ; id++)
if(is_user_connected(id))
if(get_user_flags(id) & ADMIN_VIP)
get_user_name(id, adminnames[count++], 31)
len = format(message, 255, "%s VIP ONLINE: ",COLOR)
if(count > 0) {
for(x = 0 ; x < count ; x++) {
len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
if(len > 96 ) {
print_message(user, message)
len = format(message, 255, "%s ",COLOR)
}
}
print_message(user, message)
}
else {
len += format(message[len], 255-len, "No VIP online.")
print_message(user, message)
}
}
print_message(id, msg[]) {
message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
stock chat_color(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")
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();
}
}
}
}