Raised This Month: $51 Target: $400
 12% 

Flag when kill get's extra life


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-09-2018 , 13:11   Flag when kill get's extra life
Reply With Quote #1

Hey, could anyone make me a plugin with flag o (CUSTOMFLAG1) that when that player kills anyone gets more 35hp and if kills with headshot gets 50hp.
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-09-2018 , 13:37   Re: Flag when kill get's extra life
Reply With Quote #2

Code:
public void OnPluginStart()
{
	HookEvent("player_death", Event_Player_Death);
}

public Action Event_Player_Death(Event event, const char[] name, bool dontBroadcast)
{
	int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
	if (!CheckCommandAccess(attacker, "sm_extra_hp", ADMFLAG_CUSTOM1, true))
		return Plugin_Continue;
	int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
	if (GetEventBool(event, "headshot"))
		SetEntityHealth(attacker, health + 50);
	else
		SetEntityHealth(attacker, health + 35);
	return Plugin_Continue;
}
Enjoy
__________________
Taking private requests


Last edited by KlausLaw; 06-09-2018 at 13:37.
KlausLaw is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-09-2018 , 14:32   Re: Flag when kill get's extra life
Reply With Quote #3

@KlausLaw

It worked.

Last edited by TrullSin; 06-09-2018 at 14:36.
TrullSin is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-09-2018 , 14:37   Re: Flag when kill get's extra life
Reply With Quote #4

But can you make it the max life 100hp?
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-09-2018 , 14:50   Re: Flag when kill get's extra life
Reply With Quote #5

Quote:
Originally Posted by TrullSin View Post
But can you make it the max life 100hp?
Code:
public void OnPluginStart()
{
	HookEvent("player_death", Event_Player_Death);
}

public Action Event_Player_Death(Event event, const char[] name, bool dontBroadcast)
{
	int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
	if (!CheckCommandAccess(attacker, "sm_extra_hp", ADMFLAG_CUSTOM1, true))
		return Plugin_Continue;
	int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
	if (GetEventBool(event, "headshot"))
		health += 50;
	else
		health += 35;
	SetEntityHealth(attacker, health);
	
	if (health > 100)
		SetEntityHealth(attacker, 100);
	return Plugin_Continue;
}
__________________
Taking private requests

KlausLaw is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-09-2018 , 15:04   Re: Flag when kill get's extra life
Reply With Quote #6

@KlausLaw

Is it possible to give messages with colours?
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-09-2018 , 15:09   Re: Flag when kill get's extra life
Reply With Quote #7

Quote:
Originally Posted by TrullSin View Post
@KlausLaw

Is it possible to give messages with colours?
Code:
public void OnPluginStart()
{
	HookEvent("player_death", Event_Player_Death);
}

public Action Event_Player_Death(Event event, const char[] name, bool dontBroadcast)
{
	int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
	if (!CheckCommandAccess(attacker, "sm_extra_hp", ADMFLAG_CUSTOM1, true))
		return Plugin_Continue;
	int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
	if (GetEventBool(event, "headshot"))
	{
		PrintToChat(attacker, " \x04[SM]\x01 You received \x0450\x01 HP for this headshot!");
		health += 50;
	}
	else
	{
		PrintToChat(attacker, " \x04[SM]\x01 You received \x0435\x01 HP for this kill!");
		health += 35;
	}
	
	SetEntityHealth(attacker, health);
	
	if (health > 100)
		SetEntityHealth(attacker, 100);
	return Plugin_Continue;
}
__________________
Taking private requests

KlausLaw is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode