/* Plugin Template generated by Pawn Studio */
#include <sourcemod>
#include <csgocolors>
new Handle: HPperKill
new Handle: HPperHS
new Handle: HPperKnife
new Handle: HPperNadeKill
new Handle: MaxHP
public Plugin:myinfo = {
name = "HP per Kill",
author = "tre3fla",
description = "Primesti HP la fiecare frag",
version = "1.0",
url = "http://extreamcs.com/forum"
}
public OnPluginStart( ) {
HPperKill = CreateConVar( "hp_per_normal_kill", "5", "HP primit pentru un frag normal" )
HPperHS = CreateConVar( "hp_per_head_kill", "10", "HP primit pentru un frag cu headshot" )
HPperKnife = CreateConVar( "hp_per_knife_kill", "15", "HP primit pentru un frag cu cutitul" )
HPperNadeKill = CreateConVar( "hp_per_nade_kill", "8", "HP Primit pentru un frag cu o grenada" )
MaxHP = CreateConVar( "max_hp_limit", "100", "HP-ul maxim care un jucator il poate avea !" )
HookEvent( "player_death", Event_PlayerDeath )
}
public Action:Event_PlayerDeath( Handle:event, const String:name[ ], bool:dontBroadcast ) {
new Victima = GetClientOfUserId( GetEventInt( event, "userid" ) )
new Atacator = GetClientOfUserId( GetEventInt( event, "attacker" ) )
if( Atacator <= 0 || Atacator > MaxClients ) {
return Plugin_Continue
}
if( !IsClientInGame( Victima ) ) {
return Plugin_Handled
}
if( Victima == Atacator ) {
return Plugin_Handled
}
if( GetAdminFlag( GetUserAdmin( Atacator ), Admin_Reservation ) ) {
new String: Nume[ 32 ]
GetClientName( Victima, Nume, sizeof( Nume ) )
new bool:Headshot = GetEventBool( event, "headshot" )
char Arma[ 64 ]
GetEventString( event, "weapon", Arma, sizeof( Arma ) )
if( Headshot && GetConVarInt( HPperHS ) > 0 ) {
new iHP = GetClientHealth( Atacator )
if( iHP == GetConVarInt( MaxHP ) ) {
return Plugin_Handled
}
iHP += GetConVarInt( HPperHS )
if( iHP > GetConVarInt( MaxHP ) ) {
iHP = GetConVarInt( MaxHP )
}
SetEntProp( Atacator, Prop_Data, "m_iHealth", iHP )
CPrintToChat( Atacator, "{RED}[Bonus]{NORMAL} L-ai ucis pe{GREEN} %s{NORMAL} si primit{BLUE} +%d HP", Nume, GetConVarInt( HPperHS ) )
}
else if( ( StrContains( Arma, "knife", false ) != -1 ) || ( StrContains( Arma, "bayonet", false ) != -1 ) && GetConVarInt( HPperKnife ) > 0 ) {
new iHP = GetClientHealth( Atacator )
if( iHP == GetConVarInt( MaxHP ) ) {
return Plugin_Handled
}
iHP += GetConVarInt( HPperKnife )
if( iHP > GetConVarInt( MaxHP ) ) {
iHP = GetConVarInt( MaxHP )
}
SetEntProp( Atacator, Prop_Data, "m_iHealth", iHP )
CPrintToChat( Atacator, "{RED}[Bonus]{NORMAL} L-ai ucis pe{GREEN} %s{NORMAL} si primit{BLUE} +%d HP", Nume, GetConVarInt( HPperKnife ) )
}
else if( ( StrContains( Arma, "flashbang", false ) != -1 ) || ( StrContains( Arma, "smoke", false ) != -1 ) || ( StrContains( Arma, "hegrenade", false ) != -1 ) || ( StrContains( Arma, "molotov", false ) != -1 ) || ( StrContains( Arma, "incgrenade", false ) != -1 ) || ( StrContains( Arma, "decoy", false ) != -1 ) && GetConVarInt( HPperNadeKill ) > 0 ) {
new iHP = GetClientHealth( Atacator )
if( iHP == GetConVarInt( MaxHP ) )
{
return Plugin_Handled
}
iHP += GetConVarInt( HPperNadeKill )
if( iHP > GetConVarInt( MaxHP ) ) {
iHP = GetConVarInt( MaxHP )
}
SetEntProp( Atacator, Prop_Data, "m_iHealth", iHP )
CPrintToChat( Atacator, "{RED}[Bonus]{NORMAL} L-ai ucis pe{GREEN} %s{NORMAL} si primit{BLUE} +%d HP", Nume, GetConVarInt( HPperNadeKill ) )
}
else {
if( GetConVarInt( HPperKill ) > 0 ) {
new iHP = GetClientHealth( Atacator )
if( iHP == GetConVarInt( MaxHP ) ) {
return Plugin_Handled
}
iHP += GetConVarInt( HPperKill )
if( iHP > GetConVarInt( MaxHP ) ) {
iHP = GetConVarInt( MaxHP )
}
SetEntProp( Atacator, Prop_Data, "m_iHealth", iHP )
CPrintToChat( Atacator, "{RED}[Bonus]{NORMAL} L-ai ucis pe{GREEN} %s{NORMAL} si primit{BLUE} +%d HP", Nume, GetConVarInt( HPperKill ) )
}
}
}
return Plugin_Continue
}