View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-24-2020 , 15:33   Re: [CSGO] A plugin to prevent teamkilling
Reply With Quote #2

I quick made this. When player change team, plugin look all projectiles and infernos owned by player and destroy them. Molotov and incendiary gives sound bug tough, you hear burning flames at that point where it get destroyed. I'm sure this sound loop can stop but I don't have time to look at.

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

public void OnPluginStart()
{
    
HookEventEx("player_team"player_team);
}

public 
void player_team(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));

    if(
client == || !IsClientInGame(client))
    {
        return;
    }
    
    
int ent = -1;
    
char clsname[64];

    while((
ent FindEntityByClassname(ent"*")) != -1)
    {
        if(!
GetEntityClassname(entclsnamesizeof(clsname))) continue;

        if(
StrContains(clsname"smokegrenade"false) != -1) continue;

        if(
StrContains(clsname"_projectile"false) == -&& !StrEqual(clsname"inferno"false)) continue;
        

        if( 
client == GetEntPropEnt(entProp_Send"m_hOwnerEntity") )
        {
            
//PrintToServer("Kill ent %i %s", ent, clsname);
            
AcceptEntityInput(ent"Kill");
        }
        
    }
}

/*
public void OnEntityCreated(int entity, const char[] classname)
{
    PrintToServer("classname %s", classname);
}
*/ 
__________________
Do not Private Message @me
Bacardi is offline