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

[CS:GO] Give assits on suicide ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 12-12-2017 , 08:38   [CS:GO] Give assits on suicide ?
Reply With Quote #1

Hello !

I need your help guys,

Is it possible to add an assist to a player when someone suicide if he hitted him before ? (last hitter only would be perfect)

I want to do that but I don't know if it's possible and how to do it.

Thanks in advance.
Crackynimous is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-12-2017 , 12:57   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #2

Used to have a plugin that would give the kill (or assist) to the last person who attacked the player if they try to use the kill command, I'll need to find it and upload it
Mitchell is offline
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 12-13-2017 , 14:12   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #3

Perfect! If you find it, keep me up, I'll try to adapt it for my needs

Thanks!
Crackynimous is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-13-2017 , 18:03   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #4

I had forgotten that the CS games don't do this. Guess I'm too used to TF2 which gives kills to the player who last damaged a player who suicides.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 12-14-2017 , 02:07   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #5

That's why I ask. I don't really understand why it's not implemented in :/
Any help are welcome, if you find some interesting lines, post these, and I'll work with it.
The problem is that I don't know where to start x)

Thanks!

Last edited by Crackynimous; 12-14-2017 at 02:07.
Crackynimous is offline
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 12-14-2017 , 05:27   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #6

I found this:

PHP Code:
public Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    if ( 
GetConVarInt(g_hEnabled) == )
    {
        new 
victimId GetClientOfUserIdGetEventIntevent"userid" ) );
        new 
killerId GetClientOfUserIdGetEventIntevent"attacker" ) );
        new 
csgoAssisterId;
        
        if ( 
IsClientInGamevictimId ) )
        {
            
//Killer points bonus
            
if (killerId != && //The world can't gain points
                    
killerId <= MaxClients && //No random entities can be assisters (ex: barrel (:o))
                    
IsClientInGame(killerId) &&
                    
GetClientTeam(victimId) != GetClientTeam(killerId)) //We don't want our allies to gain points for killing us !
            
{
                
SetEntProp(killerIdProp_Data"m_iFrags"GetClientFrags(killerId) + GetConVarInt(g_hAddKillerScore));
            }
            
            
//Assists ($ + points)
            
decl assistersMaxClients ]; //Our assisters array
            
new nbAssisters//Its length
            
            
new minDmgNeededForAssist GetConVarInt(g_hMinDmg);
            if ( 
g_currentMod == GAME_CSGO && GetConVarIntg_hUseInGameThreshold ) == )
            {
                
minDmgNeededForAssist GetConVarIntg_hConVarAssistDamageThreshold ) + 1//by default it's 40 but you need 41 for a Kill Assist
            
}
            
            
//Get assisters
            
if ( g_currentMod == GAME_CSGO )
                
csgoAssisterId GetClientOfUserIdGetEventIntevent"assister" ) ); //to avoid overgiving assists
            
            
if ( g_currentMod != GAME_CSGO || GetConVarIntg_hUseInGameAssistSystem ) == )
            {
                for ( new 
MaxClients>= 1; --)
                    if ( 
g_dmgToClientvictimId ][ ] >= minDmgNeededForAssist && killerId != )//If the minimum dmg is done && the killer doesn't get assist cash
                        
assistersnbAssisters++ ] = i;
            }
            else 
//game is CSGO & we use the ingame assist system
            
{
                if ( 
csgoAssisterId != )
                {
                    
assistersnbAssisters++ ] = csgoAssisterId;
                }
            }
            
            if ( 
nbAssisters //If we have assisters, we calculate money & assists to give them
            
{
                if ( 
g_currentMod == GAME_CSS || g_currentMod == GAME_CSGO //Money = CS:S/GO
                
{
                    
decl moneyToGive;
                    
                    if ( 
g_currentMod == GAME_CSS || 
                            ( 
g_currentMod == GAME_CSGO && GetConVarIntg_hRewardType ) == ) )
                    {
                        
moneyToGive GetConVarInt(g_hReward);
                    }
                    else 
//CS:GO && fraction of killer gain
                    
{
                        
//DEPENDING ON THE WPN, GET $ GAINED
                        
decl String:wpn32 ];
                        
GetEventString(event"weapon"wpnsizeof(wpn)); //3 other doesn't really help :/
                        
                        
if ( StrContainswpn"knife"false ) == //GG CSGO @ knife_t ; knife_default_ct ... seems to be the only exception
                            
wpn "knife";
                        
                        
decl moneyGainedByKiller;
                        
                        if ( !
GetTrieValueg_hWeaponPriceTriewpnmoneyGainedByKiller ) )
                        {
                            
moneyGainedByKiller 300//seems to always be this when not defined
                        
}
                        
                        
moneyToGive RoundToFloorfloatmoneyGainedByKiller ) * GetConVarFloatg_hReward ) * GetConVarFloatg_hConVarCashFactor ) );
                    }
                    
                    if ( 
moneyToGive )
                    {
                        if ( 
GetConVarInt(g_hSplit) == )
                            
moneyToGive /= nbAssisters;
                        
                        
GiveMoneyassistersnbAssistersmoneyToGiveGetClientTeamvictimId ) );
                    }
                }
                
                
GiveAssistPointsassistersnbAssisterskillerIdvictimIdcsgoAssisterIdGetClientTeamvictimId ) );
                
                
#if defined DEV_INTERFACE
                
Call_StartForwardg_hForwardKillAssist );
                
Call_PushArrayassistersnbAssisters );
                
Call_PushCellnbAssisters );
                
Call_PushCellkillerId );
                
Call_PushCellvictimId );
                
Call_Finish();
                
#endif
            
}
        }
    }
    
    return 
bool:Plugin_Continue;

Full plugin here: https://forums.alliedmods.net/showthread.php?p=1430830

I don't know if it works, and the code is hard (anyway for me). I'll try to do something with this.

Otherwise, if someone have something easier x)
Crackynimous is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-14-2017 , 11:21   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #7

I realized my suicide script was only for players who used the "Kill" Command. When using it, it will give the kill to whoever did the most damage to the player, or will pick a random alive person instead.
Attached Files
File Type: sp Get Plugin or Get Source (suicideprevent.sp - 217 views - 4.9 KB)
Mitchell is offline
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 12-14-2017 , 12:25   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #8

Thank you! I'll read this and I'll try to understand it :p
Crackynimous is offline
Crackynimous
AlliedModders Donor
Join Date: Jul 2015
Location: France
Old 01-06-2018 , 10:02   Re: [CS:GO] Give assits on suicide ?
Reply With Quote #9

I realized that CSGO give assists when the player gives at least 41 damage.

I did that :

PHP Code:
public Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
damagetype DMG_FALL)
    {
        
damage float(GetClientHealth(client) + GetClientArmor(client));
        return 
Plugin_Changed;
    }
    
damage 41.0;
    
SetEntProp(clientProp_Send"m_iHealth"1001);
    return 
Plugin_Changed;

(I refill life because I want that players dies only from falling)

I want that the assist be given to the last player who did damage, but it give the assist to the first player who did damage.

Someone have an idea on how to do that ?

@Mitchell I tried to use your code, but it's to hard for me
Crackynimous is offline
Reply


Thread Tools
Display Modes

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 07:19.


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