Raised This Month: $18 Target: $400
 4% 

Solved GetClientTeam error


Post New Thread Reply   
 
Thread Tools Display Modes
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
r4f4w
Member
Join Date: Jul 2019
Old 07-24-2020 , 10:31   Re: GetClientTeam error
Reply With Quote #2

Just updated the sourcemod and fixed everthing!
r4f4w is offline
thekings4fun
Junior Member
Join Date: Apr 2020
Old 07-25-2020 , 11:07   Re: GetClientTeam error
Reply With Quote #3

Quote:
Originally Posted by r4f4w View Post
Just updated the sourcemod and fixed everthing!

here for me on my server it didn't work, I need something that will leave the damage only with molotov and grenade.
thekings4fun is offline
Reply


Thread Tools
Display Modes

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 02:12.


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