Raised This Month: $32 Target: $400
 8% 

[CSGO] A plugin to prevent teamkilling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PeterPan
Junior Member
Join Date: Mar 2020
Old 03-24-2020 , 11:47   [CSGO] A plugin to prevent teamkilling
Reply With Quote #1

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
PeterPan is offline
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
PeterPan
Junior Member
Join Date: Mar 2020
Old 03-24-2020 , 16:02   Re: [CSGO] A plugin to prevent teamkilling
Reply With Quote #3

Works great thank you.
PeterPan is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 03-26-2020 , 11:28   Re: [CSGO] A plugin to prevent teamkilling
Reply With Quote #4

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.
PC Gamer is offline
Reply



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 18:04.


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