View Single Post
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