PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <clientprefs>
#define VIP_FLAG ADMFLAG_CUSTOM6
Handle: Armor
Handle: Helmet
Handle: Bhop
Handle: Defuser
Handle: VipSpeed
Handle: SpeedAmmount
Handle: Damage
Handle: DamageAmount
Handle: HE
Handle: Flash
Handle: Molotov
Handle: Smoke
Handle: PistolRoundRule
Handle: HpNormalKill
Handle: HpKnifeKill
Handle: HpHeadShotKill
Handle: MaxHP
Handle: MoneyPerNormalKill
Handle: MoneyPerKnifeKill
Handle: MoneyPerHeadShotKill
Handle: ExtraMoneyOnSpawn
Handle: ShowBombsite
Handle: HalfPlantTime
Handle: HalfDefuseTimeNoKit
Handle: HalfDefuseTimeKit
Handle: Notify
new Handle: BhopCookie = INVALID_HANDLE
new MoneyOffset = -1
new RoundID = 0
bool: CanBhop[ MAXPLAYERS + 1 ]
bool: IsPistolRound = false
public Plugin:myinfo = {
name = "CS:GO VIP",
author = "tre3fla",
description = "VIP pentru serverele de csgo",
version = "1.2",
url = "http://extreamcs.com/forum"
}
public OnPluginStart( ) {
Armor = CreateConVar( "vip_give_armor", "1", "VIP primeste 100 armura la spawn" )
Helmet = CreateConVar( "vip_give_helmet", "1", "VIP primeste helmet daca are armura" )
Bhop = CreateConVar( "vip_autobhop", "0", "VIP poate face bhop automat cand tine apasat space" )
Defuser = CreateConVar( "vip_give_ct_defuser", "1", "VIP primeste defuser atunci cand este CT" )
VipSpeed = CreateConVar( "vip_fast_speed", "0", "VIP primeste viteza de miscare mai mare" )
SpeedAmmount = CreateConVar( "vip_speed_amount", "1.2", "Cat de rapid sa se miste VIP" )
Damage = CreateConVar( "vip_high_damage", "0", "VIP va avea damage mai mare" )
DamageAmount = CreateConVar( "vip_damage_amount", "2", "Cu cat sa fie multiplicat damage-ul vipului" )
HE = CreateConVar( "vip_give_he", "1", "VIP primeste un HE la spawn, daca nu are deja unul" )
Flash = CreateConVar( "vip_give_flash", "1", "VIP primeste un flash la spawn, daca nu are deja unul" )
Molotov = CreateConVar( "vip_give_molotov", "1", "VIP primeste molotov la spawn daca nu are deja unul" )
Smoke = CreateConVar( "vip_give_smoke", "1", "VIP primeste smoke la spawn daca nu are deja unul" )
PistolRoundRule = CreateConVar( "vip_disabled_on_pistol_round", "0", "VIP nu va rula un in rundele de pistoale pe competitive" )
ExtraMoneyOnSpawn = CreateConVar( "vip_give_money_on_spawn", "0", "VIP va primi aceea suma de bani la spawn. 0=dezactivat" )
HpNormalKill = CreateConVar( "vip_normal_kill_hp", "5", "VIP va primi HP cand face frag" )
HpKnifeKill = CreateConVar( "vip_knife_kill_hp", "5", "VIP va primi HP cand face frag cu cutitul" )
HpHeadShotKill = CreateConVar( "vip_headshot_hp", "10", "VIP va primit HP cand face frag cu headshot" )
MaxHP = CreateConVar( "vip_max_hp", "130", "HP-ul maxim pe care il poate avea un VIP" )
MoneyPerNormalKill = CreateConVar( "vip_normal_kill_money", "0", "VIP va primi acea suma de bani cand face frag" )
MoneyPerKnifeKill = CreateConVar( "vip_knife_kill_money", "0", "VIP va primi acea suma de bani cand face frag cu cutitul" )
MoneyPerHeadShotKill = CreateConVar( "vip_headshot_kill_money", "0", "VIP va primi acea suma de bani cand face frag cu headshot" )
ShowBombsite = CreateConVar( "vip_show_bombsite", "1", "VIP de la ct vor vedea in ce bombsite au plantat teroristii bomba" )
HalfPlantTime = CreateConVar( "vip_bomb_plant_time", "2", "Timp in secunde pentru plantarea bombei de catre VIP" )
HalfDefuseTimeNoKit = CreateConVar( "vip_defuse_time_nokit", "5", "Timp necesar pentru ca VIP sa dea defuse bombei cand nu are kit" )
HalfDefuseTimeKit = CreateConVar( "vip_defuse_time_kit", "2.5", "Timp necesar pentru ca VIP sa dea defuse bombei cand are kit" )
Notify = CreateConVar( "vip_notify_on_bonus", "1", "VIP vor vedea mesaje in chat cand primesc hp, bani, etc" )
MoneyOffset = FindSendPropInfo( "CCSPlayer", "m_iAccount" )
RegConsoleCmd( "bhop", Command_ToggleBhop )
RegConsoleCmd( "vips", Command_ShowVips )
BhopCookie = RegClientCookie( "AutoBhop", "Cookie AutoBhop", CookieAccess_Protected )
HookEvent( "player_spawn", Event_PlayerSpawn )
HookEvent( "player_death", Event_PlayerDeath )
HookEvent( "announce_phase_end", Event_PhaseEnd )
HookEvent( "bomb_planted", Event_BombPlanted )
HookEventEx( "bomb_begindefuse", Event_BeginDefuse )
HookEventEx( "bomb_beginplant", Event_BeginPlant )
HookEvent( "round_end", Event_RoundEnd, EventHookMode_PostNoCopy )
}
public OnMapStart( ) {
RoundID = 0
IsPistolRound = false
}
public OnClientCookiesCached( client ) {
decl String: UserCookie[ 5 ]
GetClientCookie( client, BhopCookie, UserCookie, sizeof( UserCookie ) )
if( StrEqual( UserCookie, "1" ) && IsClientVip( client ) ) {
CanBhop[ client ] = true
}
else {
CanBhop[ client ] = false
SetClientCookie( client, BhopCookie, "0" )
}
}
public OnClientPutInServer( client ) {
SDKHook( client, SDKHook_WeaponSwitchPost, WeaponSwitchPost )
SDKHook( client, SDKHook_OnTakeDamage, OnTakeDamage )
}
public Action: Event_PlayerSpawn( Handle: event, const String: name[ ], bool: dontBroadcast ) {
if( GetConVarBool( PistolRoundRule ) && IsPistolRound ) {
return Plugin_Handled
}
new client = GetClientOfUserId( GetEventInt( event, "userid" ) )
if( client > 0 && client < MaxClients && IsClientInGame( client ) && IsPlayerAlive( client ) && !IsFakeClient( client ) ) {
if( IsClientVip( client ) ) {
CS_SetClientClanTag(client, "VIP")
RemoveClientGrenades( client )
RequestFrame( GiveSpawnItems, client )
}
}
return Plugin_Continue
}
public Action: Event_PlayerDeath( Handle: event, const String: name[ ], bool: dontBroadcast ) {
if( GetConVarBool( PistolRoundRule ) && IsPistolRound ) {
return Plugin_Handled
}
new victim = GetClientOfUserId( GetEventInt( event, "userid" ) )
new attacker = GetClientOfUserId( GetEventInt( event, "attacker" ) )
if( attacker > 0 && attacker < MaxClients && IsClientInGame( attacker ) && victim > 0 && victim < MaxClients && IsClientInGame( victim ) && IsClientVip( attacker ) && attacker != victim ) {
new bool:Headshot = GetEventBool( event, "headshot" )
char Arma[ 64 ]
GetEventString( event, "weapon", Arma, sizeof( Arma ) )
if( Headshot ) {
if( GetConVarInt( MoneyPerHeadShotKill ) > 0 && MoneyOffset != -1 ) {
SetEntProp( attacker, Prop_Send, "m_iAccount", GetEntProp( attacker, Prop_Send, "m_iAccount" ) + GetConVarInt( MoneyPerHeadShotKill ) )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál extrát\x06 $%d\x10 mert megöltél egy ellenséget!", GetConVarInt( MoneyPerHeadShotKill ) )
}
}
if( GetConVarInt( HpHeadShotKill ) > 0 && GetClientHealth( attacker ) < GetConVarInt( MaxHP ) ) {
new ClientHealth = GetClientHealth( attacker )
ClientHealth += GetConVarInt( HpHeadShotKill )
if( ClientHealth > GetConVarInt( MaxHP ) ) {
ClientHealth = GetConVarInt( MaxHP )
}
SetEntProp( attacker, Prop_Data, "m_iHealth", ClientHealth )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál\x06 %d életerőt\x10 mert megöltél egy ellenséget!", GetConVarInt( HpHeadShotKill ) )
}
}
}
else if( ( StrContains( Arma, "knife", false ) != -1 ) || ( StrContains( Arma, "bayonet", false ) != -1 ) ) {
if( GetConVarInt( MoneyPerKnifeKill ) > 0 && MoneyOffset != -1 ) {
SetEntProp( attacker, Prop_Send, "m_iAccount", GetEntProp( attacker, Prop_Send, "m_iAccount" ) + GetConVarInt( MoneyPerKnifeKill ) )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál extra\x06 $%d\x10 mert megöltél egy ellenséget!", GetConVarInt( MoneyPerKnifeKill ) )
}
}
if( GetConVarInt( HpKnifeKill ) > 0 && GetClientHealth( attacker ) < GetConVarInt( MaxHP ) ) {
new ClientHealth = GetClientHealth( attacker )
ClientHealth += GetConVarInt( HpKnifeKill )
if( ClientHealth > GetConVarInt( MaxHP ) ) {
ClientHealth = GetConVarInt( MaxHP )
}
SetEntProp( attacker, Prop_Data, "m_iHealth", ClientHealth )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál\x06 %d életerőt\x10 mert megöltél egy ellenséget!", GetConVarInt( HpKnifeKill ) )
}
}
}
else {
if( GetConVarInt( MoneyPerNormalKill ) > 0 && MoneyOffset != -1 ) {
SetEntProp( attacker, Prop_Send, "m_iAccount", GetEntProp( attacker, Prop_Send, "m_iAccount" ) + GetConVarInt( MoneyPerNormalKill ) )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál extra\x06 $%d\x10 mert megöltél egy ellenséget!", GetConVarInt( MoneyPerNormalKill ) )
}
}
if( GetConVarInt( HpNormalKill ) > 0 && GetClientHealth( attacker ) < GetConVarInt( MaxHP ) ) {
new ClientHealth = GetClientHealth( attacker )
ClientHealth += GetConVarInt( HpNormalKill )
if( ClientHealth > GetConVarInt( MaxHP ) ) {
ClientHealth = GetConVarInt( MaxHP )
}
SetEntProp( attacker, Prop_Data, "m_iHealth", ClientHealth )
if( GetConVarBool( Notify ) ) {
PrintToChat( attacker, " \x04[VIP]\x10 Sikeresen kaptál\x06 %d életerőt\x10 mert megöltél egy ellenséget!", GetConVarInt( HpNormalKill ) )
}
}
}
}
return Plugin_Continue
}
public Event_PhaseEnd( Handle: event, const String: name[ ], bool: dontBroadcast ) {
IsPistolRound = true
}
public Event_BeginDefuse( Handle: event, const String: name[ ], bool: dontBroadcast ) {
if( GetConVarBool( PistolRoundRule ) && !IsPistolRound ) {
new client = GetClientOfUserId( GetEventInt( event,"userid" ) )
if( client > 0 && client < MaxClients && IsPlayerAlive( client ) && IsClientVip( client ) && GetConVarBool( HalfDefuseTimeKit ) || GetConVarBool( HalfDefuseTimeNoKit ) ) {
CreateTimer( 0.0, DefuseBugFix, client )
}
}
}
public Event_BeginPlant( Handle: event, const String: name[ ], bool: dontBroadcast ) {
if( GetConVarBool( PistolRoundRule ) && !IsPistolRound ) {
new client = GetClientOfUserId( GetEventInt( event, "userid" ) )
if( client > 0 && client < MaxClients && IsPlayerAlive( client ) && IsClientVip( client ) && GetConVarBool( HalfPlantTime ) ) {
new Bomb = GetEntPropEnt( client, Prop_Send, "m_hActiveWeapon" )
decl String: EntityName[ 20 ]
GetEntityClassname( Bomb, EntityName, sizeof( EntityName ) )
if( StrEqual( EntityName, "weapon_c4", false ) ) {
SetEntPropFloat( Bomb, Prop_Send, "m_fArmedTime", GetGameTime()+GetConVarFloat( HalfPlantTime ) )
}
}
}
}
public Event_BombPlanted( Handle: event, const String: name[ ], bool: dontBroadcast ) {
if( GetConVarBool( PistolRoundRule ) && !IsPistolRound ) {
if( GetConVarBool( ShowBombsite ) ) {
new client = GetClientOfUserId( GetEventInt( event, "userid" ) )
decl String: Bombsite[ 64 ]
GetEntPropString( client, Prop_Send, "m_szLastPlaceName", Bombsite, sizeof( Bombsite ) )
decl String: BombsiteBuffer[ 32 ]
if( StrContains( Bombsite, "BombsiteA" ) != -1 ) {
Format( BombsiteBuffer, sizeof( BombsiteBuffer ), "Bombsite A" )
}
else if( StrContains( Bombsite, "BombsiteB" ) != -1 ) {
Format( BombsiteBuffer, sizeof( BombsiteBuffer ), "Bombsite B" )
}
for( new i = 1; i < MaxClients; i++ ) {
if( IsClientInGame( i ) && IsClientVip( i ) && GetClientTeam( i ) == 3 && IsPlayerAlive( i ) ) {
PrintToChat( i, " \x04[VIP]\x02 %N\x10 lerakta a bombát ide:\x04 %s", client, BombsiteBuffer )
}
}
}
}
}
public Event_RoundEnd( Handle: event, const String: name[ ], bool: dontBroadcast ) {
RoundID++
if( RoundID == 1 ) {
IsPistolRound = true
}
else {
IsPistolRound = false
}
}
public Action: OnPlayerRunCmd( client, &buttons, &impulse, Float: vel[ 3 ], Float: angles[ 3 ], &weapon ) {
if( IsClientVip( client ) && GetConVarBool( Bhop ) && CanBhop[ client ] ) {
if( buttons & IN_JUMP && IsPlayerAlive( client ) && !( GetEntityFlags( client ) & FL_ONGROUND ) && !( GetEntityMoveType( client ) & MOVETYPE_LADDER ) ) {
buttons &= ~IN_JUMP
}
}
}
public Action: DefuseBugFix( Handle: timer, any: client ) {
if( client > 0 && client < MaxClients && IsClientInGame( client ) && IsPlayerAlive( client ) ) {
new Bomb = FindEntityByClassname( MaxClients+1, "planted_c4" )
if( Bomb != -1 ) {
if( GetEntProp( client, Prop_Send, "m_bHasDefuser" ) ) {
SetEntPropFloat( Bomb, Prop_Send, "m_flDefuseCountDown", GetGameTime( ) + GetConVarFloat( HalfDefuseTimeKit ) )
SetEntPropFloat( client, Prop_Send, "m_flProgressBarStartTime", GetGameTime( ) )
SetEntProp( client, Prop_Send, "m_iProgressBarDuration", GetConVarInt( HalfDefuseTimeKit ) )
}
else {
SetEntPropFloat( Bomb, Prop_Send, "m_flDefuseCountDown", GetGameTime( ) + GetConVarFloat( HalfDefuseTimeNoKit ) )
SetEntPropFloat( client, Prop_Send, "m_flProgressBarStartTime", GetGameTime( ) )
SetEntProp( client, Prop_Send, "m_iProgressBarDuration", GetConVarInt( HalfDefuseTimeNoKit ) )
}
}
}
}
public GiveSpawnItems( client ) {
if( client > 0 && client < MaxClients && IsClientInGame( client ) && IsPlayerAlive( client ) && GetClientTeam( client ) > 1 ) {
if( GetConVarBool( Armor ) ) {
SetEntProp( client, Prop_Send, "m_ArmorValue", 100 )
}
if( GetConVarBool( Helmet ) && GetEntProp( client, Prop_Send, "m_ArmorValue" ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_bHasHelmet", 1 )
}
if( GetConVarBool( HE ) && GetEntProp( client, Prop_Send, "m_iAmmo", _, 14 ) < 1 && GetClientGrenades( client ) < GetConVarInt( FindConVar( "ammo_grenade_limit_total") ) ) {
GivePlayerItem( client, "weapon_hegrenade" )
}
if( GetConVarBool( Flash ) && GetEntProp( client, Prop_Send, "m_iAmmo", _, 15 ) < 1 && GetClientGrenades( client ) < GetConVarInt( FindConVar( "ammo_grenade_limit_total") ) ) {
GivePlayerItem( client, "weapon_flashbang" )
}
if( GetConVarBool( Smoke ) && GetEntProp( client, Prop_Send, "m_iAmmo", _, 16 ) < 1 && GetClientGrenades( client ) < GetConVarInt( FindConVar( "ammo_grenade_limit_total") ) ) {
GivePlayerItem( client, "weapon_smokegrenade" )
}
if( GetConVarBool( Molotov ) && GetEntProp( client, Prop_Send, "m_iAmmo", _, 17 ) < 1 && GetClientGrenades( client ) < GetConVarInt( FindConVar( "ammo_grenade_limit_total") ) ) {
switch( GetClientTeam( client ) ) {
case 2: {
GivePlayerItem( client, "weapon_molotov" )
}
case 3: {
GivePlayerItem( client, "weapon_incgrenade" )
}
}
}
if( GetConVarBool( ExtraMoneyOnSpawn ) && MoneyOffset != -1 ) {
SetEntProp( client, Prop_Send, "m_iAccount", GetEntProp( client, Prop_Send, "m_iAccount" ) + GetConVarInt( ExtraMoneyOnSpawn ) )
}
if( GetConVarBool( Defuser ) && GetClientTeam( client ) == 3 && GetEntProp( client, Prop_Send, "m_bHasDefuser" ) < 1 ) {
SetEntProp( client, Prop_Send, "m_bHasDefuser", 1 )
}
}
}
public Action: Command_ToggleBhop( client, args ) {
if( GetConVarBool( PistolRoundRule ) && IsPistolRound ) {
PrintToChat( client, " \x04[VIP]\x10 Auto-bhop cannot be used in pistol rounds!" )
return Plugin_Handled
}
if( GetConVarBool( Bhop ) && IsClientVip( client ) ) {
if( CanBhop[ client ] ) {
CanBhop[ client ] = false
SetClientCookie( client, BhopCookie, "0" )
PrintToChat( client, " \x04[VIP]\x10 Auto-bhop was\x02 disabled\x10!" )
}
else {
CanBhop[ client ] = true
SetClientCookie( client, BhopCookie, "1" )
PrintToChat( client, " \x04[VIP]\x10 Auto-bhop was\x06 enabled\x10!" )
}
}
else {
PrintToChat( client, " \x04[VIP]\x10 VIP-nek\x06 kell lenned\x10 ,hogy használd ezt a parancsot!" )
}
return Plugin_Continue
}
public Action: Command_ShowVips( client, args ) {
new Handle: OnlineVips = CreateMenu( OnlineVips_Handler )
SetMenuTitle( OnlineVips, "Online VIP-játékosok listája" )
new OnlineVipsNum
for( new i = 1; i < MaxClients; i++ ) {
if( IsClientInGame( i ) && IsClientVip( i ) ) {
decl String: uNameBuffer[ 32 ]
Format( uNameBuffer, sizeof( uNameBuffer ), "%N", i )
AddMenuItem( OnlineVips, "OnSelect", uNameBuffer, ITEMDRAW_DISABLED )
OnlineVipsNum++
}
}
if( OnlineVipsNum < 1 ) {
if( OnlineVips != INVALID_HANDLE ) {
CloseHandle( OnlineVips )
}
PrintToChat( client, " \x04[VIP]\x10 Jelenleg nincs Online VIP-játékos!" )
}
else {
SetMenuExitButton( OnlineVips, true )
DisplayMenu( OnlineVips, client, 30 )
}
}
public OnlineVips_Handler( Handle: OnlineVips, MenuAction: action, client, menu ) {
switch( action ) {
case MenuAction_End: {
if( OnlineVips != INVALID_HANDLE ) {
CancelMenu( OnlineVips )
}
}
}
}
public Action: WeaponSwitchPost( client, weapon ) {
if( IsClientVip( client ) && IsPlayerAlive( client ) && GetConVarBool( VipSpeed ) ) {
SetEntPropFloat( client, Prop_Send, "m_flVelocityModifier", GetConVarFloat( SpeedAmmount ) )
}
}
public Action: OnTakeDamage( victim, &attacker, &inflictor, &Float:damage, &damagetype ) {
if( inflictor > 0 && inflictor < MaxClients && IsClientInGame( inflictor ) && GetClientTeam( inflictor ) != GetClientTeam( victim ) ) {
if( IsClientVip( inflictor ) && GetConVarBool( Damage ) ) {
damage = ( damage * GetConVarInt( DamageAmount ) )
return Plugin_Changed
}
}
return Plugin_Continue
}
stock bool: IsClientVip( client ) {
if( GetUserFlagBits( client ) & VIP_FLAG ) {
return true
}
return false
}
stock GetClientGrenades( client ) {
new Explosive = GetEntProp( client, Prop_Send, "m_iAmmo", _, 14 )
new Flashbang = GetEntProp( client, Prop_Send, "m_iAmmo", _, 15 )
new Smokegrenade = GetEntProp( client, Prop_Send, "m_iAmmo", _, 16 )
new Incendiary = GetEntProp( client, Prop_Send, "m_iAmmo", _, 17 )
new Decoy = GetEntProp( client, Prop_Send, "m_iAmmo", _, 18 )
return Explosive + Flashbang + Smokegrenade + Incendiary + Decoy
}
stock RemoveClientGrenades( client ) {
if( GetEntProp( client, Prop_Send, "m_iAmmo", _, 14 ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_iAmmo", 0, _, 14 )
}
if( GetEntProp( client, Prop_Send, "m_iAmmo", _, 15 ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_iAmmo", 0, _, 15 )
}
if( GetEntProp( client, Prop_Send, "m_iAmmo", _, 16 ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_iAmmo", 0, _, 16 )
}
if( GetEntProp( client, Prop_Send, "m_iAmmo", _, 17 ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_iAmmo", 0, _, 17 )
}
if( GetEntProp( client, Prop_Send, "m_iAmmo", _, 18 ) >= 1 ) {
SetEntProp( client, Prop_Send, "m_iAmmo", 0, _, 18 )
}
}