#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < fun >
#include < geoip >
#include < cstrike >
#include < colorchat >
#include < hamsandwich >
#define PLUGIN "Simple Surf Vip"
#define VERSION "1.1"
#define CN_SOUND "buttons/bell1.wav" // Csatlakozó hang
#define DC_SOUND "fvox/blip.wav" // Lecsatlakozó hang
#define XO_PLAYER 5
#define m_flFlashedUntil 514
#define m_flFlashedAt 515
#define m_flFlashHoldTime 516
#define m_flFlashDuration 517
#define m_iFlashAlpha 518
#define ALPHA_FULLBLINDED 255
#define VIP_ACCESS ADMIN_LEVEL_C
#define is_vip(%1) ( get_user_flags(%1) & VIP_ACCESS )
/* Mennyi életet kapjon a VIP, alap beállítás 130 */
#define VIP_HEALTH ( 130 )
new g_pCvarHsBonus, g_pCvarKillBonus
new g_pCvarHpPerHeadShot, g_pCvarHpPerKill
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, "Baws" )
register_cvar( "surfvip_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
set_cvar_string( "surfvip_version", VERSION );
register_message( get_user_msgid( "SayText" ), "VipTag" );
RegisterHam( Ham_Spawn, "player", "Fwd_VipSpawn", true );
RegisterHam( Ham_Killed, "player", "Fwd_PlayerKilled_Post", 1 );
register_event( "DeathMsg", "eDeathMsg", "a" );
register_logevent( "eRoundStart", 2, "1=Round_Start" )
g_pCvarHpPerHeadShot = register_cvar( "surfvip_hp_per_hs", "0" ) //Mennyi életet kapjon fejlövésért.
g_pCvarHpPerKill = register_cvar( "surfvip_hp_per_kill", "0" ) //Mennyi életet kapjon sima ölésért.
g_pCvarHsBonus = register_cvar( "surfvip_money_per_hs", "0" ) //Mennyi pénzt kapjon fejlövésért.
g_pCvarKillBonus = register_cvar( "surfvip_money_per_kill", "0" ) //Mennyi pénzt kapjon sima ölésért.
/* VIP ellenőrzés parancsok */
register_clcmd( "say /vip", "showvips_online" )
register_clcmd( "say_team /vip", "showvips_online" )
register_clcmd( "say /vips", "showvips_online" )
register_clcmd( "say_team /vips", "showvips_online" )
}
public showvips_online( id )
{
new iPlayers[ 32 ], iNum, iPlayerId, szName[ 32 ]
get_players( iPlayers, iNum, "ch" )
new iLen, szMessage[ ( sizeof iPlayers ) * charsmax( szName ) ]
iLen = formatex( szMessage, charsmax( szMessage ), "^x04Online VIP-k: " )
for( new i; i < iNum; i++ )
{
iPlayerId = iPlayers[ i ]
if( is_vip( iPlayerId ) )
{
get_user_name( iPlayerId, szName, 31 )
iLen += formatex( szMessage[ iLen ], charsmax( szMessage ) - iLen, " %s%s", szName, iLen ? "," : "" )
}
}
ColorChat( id, GREEN, szMessage )
}
public client_putinserver( id )
{
if( !is_user_bot( id ) )
{
new szName[ 32 ], szCountry[ 46 ];
get_user_name( id, szName, 31 );
szCountry = get_user_country( id );
if( get_user_flags( id ) & VIP_ACCESS )
{
ColorChat( 0, GREEN, "^x04* ^x01VIP^x04 %s (%s)^x01 csatlakozott ^x04*", szName, szCountry );
client_cmd( 0, "spk %s", CN_SOUND )
}
}
}
public client_disconnect( id )
{
if( !is_user_bot( id ) )
{
new szName[ 32 ], szCountry[ 46 ];
get_user_name( id, szName, 31 );
szCountry = get_user_country( id );
if( get_user_flags( id ) & VIP_ACCESS )
{
ColorChat( 0, GREEN, "^x04* ^x01VIP^x04 %s (%s)^x01 lecsatlakozott ^x04*", szName, szCountry );
client_cmd( 0, "spk %s", DC_SOUND )
}
}
}
public Fwd_VipSpawn( id )
{
if( is_user_alive( id ) && get_user_flags( id ) & VIP_ACCESS )
{
give_item(id, "weapon_m3")
cs_set_user_bpammo(id, CSW_M3, 35)
set_user_health( id, VIP_HEALTH );
}
}
public get_user_country( index )
{
static szIP[ 32 ], szCountry[ 46 ];
get_user_ip( index, szIP, 31 );
geoip_country( szIP, szCountry );
if( equal( szCountry, "error" ) )
{
if( !contain( szIP, "192.168." ) || !contain( szIP, "10. " ) || !contain( szIP, "172." ) || equal( szIP, "127.0.0.1" ) )
szCountry = "LAN";
else if( equal( szIP, "loopback" ) )
szCountry = "ListenServer User";
else
szCountry = "Unknown Country";
}
return szCountry;
}
public VipTag( msgId, msgDest, msgEnt )
{
new id = get_msg_arg_int( 1 );
if( is_user_connected( id ) && get_user_flags( id ) & VIP_ACCESS )
{
new szTmp[ 256 ],
szTmp2[ 256 ];
get_msg_arg_string( 2, szTmp, charsmax( szTmp ) );
new szPrefix[ 64 ] = "^x01[ ^x04VIP ^x01]";
if( !equal( szTmp, "#Cstrike_Chat_All" ) )
{
add( szTmp2, charsmax( szTmp2 ), szPrefix );
add( szTmp2, charsmax( szTmp2 ), " " );
add( szTmp2, charsmax( szTmp2 ), szTmp );
}
else
{
add( szTmp2, charsmax( szTmp2 ), szPrefix );
add( szTmp2, charsmax( szTmp2 ), "^x03 %s1^x01 : %s2" );
}
set_msg_arg_string( 2, szTmp2 );
}
return PLUGIN_CONTINUE;
}
public eRoundStart( )
{
new players[ 32 ], iCount, iPlayer
get_players( players, iCount, "ch" )
for( new i; i < iCount; i++ )
{
iPlayer = players[ i ]
if( is_vip( iPlayer ) && is_user_alive( iPlayer ) )
{
new Weapons[ 32 ], iNum
new iWepBitSum = /**/~/**/get_user_weapons( iPlayer, Weapons, iNum )
}
}
}
public eDeathMsg( id )
{
new hp_added[ 64 ];
static iHeadShot, iVictim, iKillerId
iKillerId = read_data( 1 )
iVictim = read_data( 2 )
iHeadShot = read_data( 3 )
if ( !is_user_connected( iKillerId ) )
return PLUGIN_CONTINUE;
if( iVictim == iKillerId )
{
return PLUGIN_HANDLED;
}
if( is_vip( iKillerId ) )
{
if( iHeadShot )
{
new nHpHs_add = get_pcvar_num( g_pCvarHpPerHeadShot )
if( get_user_health( iKillerId ) > 0 )
set_user_health( iKillerId, get_user_health( iKillerId ) + nHpHs_add )
if( get_user_health( iKillerId ) )
{
format( hp_added, sizeof( hp_added ), "Szép fejlövés!", nHpHs_add )
set_hudmessage( 0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1 )
show_hudmessage( iKillerId, hp_added, nHpHs_add )
}
if( !get_user_flashed( iKillerId ) )
{
message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), { 0,0,0 }, iKillerId )
write_short( 1<<10 )
write_short( 1<<10 )
write_short( 0x0000 )
write_byte( 0 )
write_byte( 0 )
write_byte( 200 )
write_byte( 75 )
message_end( )
}
}
else
{
new nHp_add = get_pcvar_num( g_pCvarHpPerKill )
if( get_user_health( iKillerId ) > 0 )
set_user_health( iKillerId, get_user_health( iKillerId ) + nHp_add )
if( get_user_health( iKillerId ) )
{
format( hp_added, sizeof( hp_added ), "Szép ölés!", nHp_add )
set_hudmessage( 0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1 )
show_hudmessage( iKillerId, hp_added, nHp_add )
}
if( !get_user_flashed( iKillerId ) )
{
message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), { 0,0,0 }, iKillerId )
write_short( 1<<10 )
write_short( 1<<10 )
write_short( 0x0000 )
write_byte( 0 )
write_byte( 0 )
write_byte( 200 )
write_byte( 75 )
message_end( )
}
}
}
return PLUGIN_HANDLED;
}
public Fwd_PlayerKilled_Post( id )
{
new Hitzone, Weapon, Attacker = get_user_attacker( id, Weapon, Hitzone )
new Players[ 32 ], Aid;
get_players( Players, Aid )
if( 0 < Attacker <= Aid && is_user_alive( Attacker ) && Attacker != id && is_vip( Attacker ) )
{
cs_set_user_money( Attacker, cs_get_user_money( Attacker ) + get_pcvar_num( g_pCvarKillBonus ) )
if( Hitzone == 1 )
cs_set_user_money( Attacker, cs_get_user_money( Attacker ) + get_pcvar_num( g_pCvarHsBonus ) )
}
}
get_user_flashed( id, &iPercent=0 )
{
new Float:flFlashedAt = get_pdata_float( id, m_flFlashedAt, XO_PLAYER )
if( !flFlashedAt )
{
return 0
}
new Float:flGameTime = get_gametime( )
new Float:flTimeLeft = flGameTime - flFlashedAt
new Float:flFlashDuration = get_pdata_float( id, m_flFlashDuration, XO_PLAYER )
new Float:flFlashHoldTime = get_pdata_float( id, m_flFlashHoldTime, XO_PLAYER )
new Float:flTotalTime = flFlashHoldTime + flFlashDuration
if( flTimeLeft > flTotalTime )
{
return 0
}
new iFlashAlpha = get_pdata_int( id, m_iFlashAlpha, XO_PLAYER )
if( iFlashAlpha == ALPHA_FULLBLINDED )
{
if( get_pdata_float( id, m_flFlashedUntil, XO_PLAYER) - flGameTime > 0.0 )
{
iPercent = 100
}
else
{
iPercent = 100-floatround( ( ( flGameTime - ( flFlashedAt + flFlashHoldTime ) )*100.0 )/flFlashDuration )
}
}
else
{
iPercent = 100-floatround( ( ( flGameTime - flFlashedAt )*100.0 )/flTotalTime )
}
return iFlashAlpha
}