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

Solved [CSGO] plugin req


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-08-2018 , 16:10   [CSGO] plugin req
Reply With Quote #1

I need a plugin to print the damage in hud, like in fortnite, different color for hs and diferent color for body damage, also I want to play a sound when you hit the head
__________________

Last edited by sHoC; 06-15-2018 at 07:19.
sHoC is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-08-2018 , 19:24   Re: [CSGO] print damage in hud
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client)) SDKHook(clientSDKHook_OnTakeDamageAliveOnTakeDamage);    
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype
{
    if (
victim != attacker && attacker <= MaxClients && IsClientInGame(attacker)) 
    {
        
SetHudTextParams(-1.00.452.030144255200);
        
ShowHudText(attacker, -1"%i"RoundToFloor(damage));
    }

Something like this maybe? (Untested)
__________________

Last edited by LenHard; 06-08-2018 at 19:30.
LenHard is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-08-2018 , 20:03   Re: [CSGO] print damage in hud
Reply With Quote #3

Code:
public OnPluginStart()
{
	HookEvent("player_hurt", Event_PlayerHurt);
}

public Action Event_PlayerHurt(Handle event, char[] name, bool dontBroadcast)
{
	int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
	int victim = GetClientOfUserId(GetEventInt(event, "userid"));
	int damage_health = GetEventInt(event, "dmg_health");
	if (!IsValidClient(attacker) || !IsValidClient(victim) || attacker == victim)
		return Plugin_Continue;
	
	if (GetClientTeam(victim) == 3)
		SetHudTextParams(0.5, 0.5, 1.0, 2, 2, 252, 1, 0);
	else
		SetHudTextParams(0.5, 0.5, 1.0, 252, 2, 2, 1, 0);
	
	ShowHudText(attacker, 1, "%d", damage_health);
	return Plugin_Continue;
}


bool IsValidClient(int client)
{
	if (!(1 <= client <= MaxClients) || !IsClientInGame(client))
		return false;
	
	return true;
}
Untested.
__________________
Taking private requests


Last edited by KlausLaw; 06-08-2018 at 20:50.
KlausLaw is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 06-08-2018 , 20:26   Re: [CSGO] print damage in hud
Reply With Quote #4

Added all you requested me in steam so added different color for headshot and others fix (prevent overlap), effects like fade and sound when you hit on head (uncomment code for use it).

Tested and working well. If you need something more just let me know
Attached Files
File Type: sp Get Plugin or Get Source (fortnite_showdamage.sp - 432 views - 1.4 KB)
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 06-08-2018 at 20:48.
Franc1sco is offline
Send a message via MSN to Franc1sco
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-09-2018 , 01:46   Re: [CSGO] print damage in hud
Reply With Quote #5

Quote:
Originally Posted by Franc1sco View Post
Added all you requested me in steam so added different color for headshot and others fix (prevent overlap), effects like fade and sound when you hit on head (uncomment code for use it).

Tested and working well. If you need something more just let me know
its possible to make a text in hud too under the crosshair. when you kill someone ELIMINATED Francisco
__________________
sHoC is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 06-09-2018 , 01:52   Re: [CSGO] print damage in hud
Reply With Quote #6

Quote:
Originally Posted by sHoC View Post
its possible to make a text in hud too under the crosshair. when you kill someone ELIMINATED Francisco
Yeah ofc. I am away today so I will do it tomorrow if someone not done it before.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-09-2018 , 06:52   Re: [CSGO] print damage in hud
Reply With Quote #7

Quote:
Originally Posted by Franc1sco View Post
Yeah ofc. I am away today so I will do it tomorrow if someone not done it before.
hmm, I cant hear the sound.. I think the plugin is not downloading the sound
__________________
sHoC is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 06-09-2018 , 09:03   Re: [CSGO] print damage in hud
Reply With Quote #8

Quote:
Originally Posted by sHoC View Post
hmm, I cant hear the sound.. I think the plugin is not downloading the sound
Post here the exact code that you use and the sound for try it.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-09-2018 , 09:15   Re: [CSGO] print damage in hud
Reply With Quote #9

Quote:
Originally Posted by sH127.0.0.1:26002/oldcs.1tap.ro/sound/music/ding.mp3oC View Post
its possible to make a text in hud too under the crosshair. when you kill someone ELIMINATED Francisco
Quote:
Originally Posted by Franc1sco View Post
Post here the exact code that you use and the sound for try it.
im using your version, here is the sound http://s5.tni.ro/vuser267/sound/music/ding.mp3
__________________

Last edited by sHoC; 06-09-2018 at 14:09.
sHoC is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 06-10-2018 , 17:10   Re: [CSGO] print damage in hud
Reply With Quote #10

Quote:
Originally Posted by sHoC View Post
im using your version, here is the sound http://s5.tni.ro/vuser267/sound/music/ding.mp3
Here you go. Tested and working well
Attached Files
File Type: zip showdamage fortnite.zip (20.7 KB, 142 views)
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
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 06:45.


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