Thread: [Solved] GetClientTeam error
View Single Post
Author Message
r4f4w
Member
Join Date: Jul 2019
Old 07-24-2020 , 00:35   GetClientTeam error
Reply With Quote #1

Guys, i currently have this code in this plugin that blocks knife and zeus attack from teammates only:

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

new Handle:facaAmigo;
new 
Handle:zeusAmigo;

public 
OnPluginStart()
{
    
facaAmigo CreateConVar("block_knife_teamattack""1""Enables or disable");
    
zeusAmigo CreateConVar("block_zeus_teamattack""1""Enables or disable");
}

public 
OnClientPutInServer(client)
{
   
SDKHook(clientSDKHook_OnTakeDamageOnDamage);

}

public 
Action:OnDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(!
attacker)
        return 
Plugin_Continue;

    if(
inflictor && inflictor <= MaxClients)
    {

        new 
String:Weapon[32];
    
        new 
weapon GetEntPropEnt(inflictorProp_Send"m_hActiveWeapon");
        
GetEdictClassname(weaponWeapon32);
    
        if(
StrContains(Weapon"knife") == -&& StrContains(Weapon"taser") == -1){
            return 
Plugin_Continue;
        }
        
        if (
GetClientTeam(victim) == GetClientTeam(attacker) && GetConVarBool(facaAmigo)) {
            
PrintToChatAll("test");
            return 
Plugin_Handled;
        }
        
        if (
GetClientTeam(victim) == GetClientTeam(attacker) && GetConVarBool(zeusAmigo)) {
            
PrintToChatAll("test2");
            return 
Plugin_Handled;
        }
    }

    return 
Plugin_Continue;

After this update, i think the GetClientTeam() function is not working anymore.

I tried to put PrintToChatAll("test") to see if the IF condition was working, and didn't print.

I also tried to print the index in the chat, to see what is going on (i used IntToString() and then PrintToChatAll()), but nothing was displayed on chat.

This plugin was working until today's update (1.37.6.0)

Last edited by r4f4w; 07-24-2020 at 10:31.
r4f4w is offline