AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [CSGO] A plugin to prevent teamkilling (https://forums.alliedmods.net/showthread.php?t=322356)

PeterPan 03-24-2020 11:47

[CSGO] A plugin to prevent teamkilling
 
So i'm looking for a plugin to stop people from team killing by throwing a molotov/grenade at teammates feet then switching teams

Basically when a player throws a molotov at a teammates feet then switches team it allows the molotov to deal damage as if they threw it as an enemy so I'm looking for something to prevent this or block them from switching teams while the molotov is active

Bacardi 03-24-2020 15:33

Re: [CSGO] A plugin to prevent teamkilling
 
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);
}
*/ 


PeterPan 03-24-2020 16:02

Re: [CSGO] A plugin to prevent teamkilling
 
Works great thank you.

PC Gamer 03-26-2020 11:28

Re: [CSGO] A plugin to prevent teamkilling
 
I understood him and I don't usually play CSGO. More importantly, he provided a working solution. However, I understand why after 10 years of posting you believe it could have been a bit better.

Original:
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.

Edited:
I made this plugin quickly. When a player changes teams this plugin will find all the projectiles and infernos owned by that player and destroys them. Molotov and incendiary has a sound bug, you hear burning flames at the point where it gets destroyed. I'm sure this sound loop can be fixed but I don't have time to look at it.

You have to admit that the post was very close to to being grammatically correct.


All times are GMT -4. The time now is 14:10.

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