AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Give assits on suicide ? (https://forums.alliedmods.net/showthread.php?t=303555)

Crackynimous 12-12-2017 08:38

[CS:GO] Give assits on suicide ?
 
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.

Mitchell 12-12-2017 12:57

Re: [CS:GO] Give assits on suicide ?
 
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

Crackynimous 12-13-2017 14:12

Re: [CS:GO] Give assits on suicide ?
 
Perfect! If you find it, keep me up, I'll try to adapt it for my needs :)

Thanks!

Powerlord 12-13-2017 18:03

Re: [CS:GO] Give assits on suicide ?
 
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.

Crackynimous 12-14-2017 02:07

Re: [CS:GO] Give assits on suicide ?
 
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!

Crackynimous 12-14-2017 05:27

Re: [CS:GO] Give assits on suicide ?
 
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)

Mitchell 12-14-2017 11:21

Re: [CS:GO] Give assits on suicide ?
 
1 Attachment(s)
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.

Crackynimous 12-14-2017 12:25

Re: [CS:GO] Give assits on suicide ?
 
Thank you! I'll read this and I'll try to understand it :p

Crackynimous 01-06-2018 10:02

Re: [CS:GO] Give assits on suicide ?
 
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


All times are GMT -4. The time now is 21:43.

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