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

Automatic Headshots , Bodyshots PROBLEM PLS HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mrskaredo
New Member
Join Date: Aug 2017
Old 09-08-2017 , 09:21   Automatic Headshots , Bodyshots PROBLEM PLS HELP
Reply With Quote #1

Hello,

i have a plugin thats working great so if i hit a enemy like in arms, legs, body it will automaticly kill him and show headshot BUT from the Players View that got killed
- First the Sound for him is like normal Body kill
- he sees the bullet is killing him in like the leg

Is it possible that the Player that got killed simulate for him like normal headshot with sounds etc.?

Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom){
	if( !IsClientValid( victim ) || !IsClientValid( attacker ) ){
		return Plugin_Continue;
	}
	
	if( aimOn[ attacker ] ){
		damagetype = CS_DMG_HEADSHOT;
		
		damage = float(GetClientHealth(victim) + GetClientArmor(victim));
		
		return Plugin_Changed;
	}
	
	return Plugin_Continue;
}
mrskaredo is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 09-10-2017 , 06:21   Re: Automatic Headshots , Bodyshots PROBLEM PLS HELP
Reply With Quote #2

Hook "player_death" event (if the game has this) to ensure that:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_death"OnPlayerDeath_PreEventHookMode_Pre);
}

public 
Action OnPlayerDeath_Pre(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid"));
    if (!
IsClientValid(victim))
    {
        return 
Plugin_Continue;
    }
    
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (!
IsClientValid(attacker) || !aimOn[attacker])
    {
        return 
Plugin_Continue;
    }
    
    
event.SetBool("headshot"true);
    return 
Plugin_Changed;

cravenge 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 15:06.


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