Raised This Month: $ Target: $400
 0% 

Turn on/off friendlyfire not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
proffs
Senior Member
Join Date: Jul 2013
Old 03-27-2016 , 14:30   Turn on/off friendlyfire not working
Reply With Quote #1

I'm coding a game for players in the same team.
The game is about to kill each other, but I can't get the mp_friendlyfire to work properly.
I might be a plugin conflict I'm not sure.

When I set FF to 1 it says in the ingamechat: Server CVAR: mp_friendlyfire set to 1
but teammates can't take damage from each other.

PHP Code:
public OnPluginStart() 

    
RegConsoleCmd("menu"Command_MENY"Opens the admin menu"); 
    
    
    
FF FindConVar("mp_friendlyfire");


PHP Code:
if(StrEqual(selection"function5")) 
    {

        
GAME_ON true;
        
        for (new 
1<= MaxClientsi++)  
        {
            if (
IsClientInGame(i))
            {
                
SetConVarInt(FF1);

                if(
GetClientTeam(i) == CS_TEAM_T && IsPlayerAlive(i))
                {
                    
SetEntityHealth(i100);
                    
GivePlayerItem(i"weapon_deagle");
                }     
                else if(
GetClientTeam(i) == CS_TEAM_CT && IsPlayerAlive(i))
                {
                    
SetEntityHealth(i100);
                    
GivePlayerItem(i"weapon_deagle");

                }
            }
        }
    } 

I've got another method to do this and it's by using mp_teammate_are_enemies 1 would that work?
__________________

Last edited by proffs; 03-27-2016 at 14:32.
proffs is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-27-2016 , 14:36   Re: Turn on/off friendlyfire not working
Reply With Quote #2

Have a look at this, you might learn something from that.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 03-27-2016 at 17:51.
KissLick is offline
proffs
Senior Member
Join Date: Jul 2013
Old 03-27-2016 , 14:54   Re: Turn on/off friendlyfire not working
Reply With Quote #3

Quote:
Originally Posted by KissLick View Post
Have a look at this, you might lear something from that.
Copied a part of your code directly, it still won't work.
But what I've noticed is that it says "has attacked a teammate" once I activate friendlyfire so it has to be a plugin conflict but would the method I mention in the first post at the end work?

PHP Code:
SetConVarIntSilent("mp_friendlyfire"1); 
PHP Code:
SetConVarIntSilent(const String:ConVarName[256], ConVarValue)
{
    new 
Handle:hHndl FindConVar(ConVarName);

    if (
hHndl != INVALID_HANDLE) {
        if (
Convar_HasFlags(hHndlFCVAR_NOTIFY))
            
Convar_RemoveFlags(hHndlFCVAR_NOTIFY);

        
SetConVarInt(hHndlConVarValuetrue);
    }

__________________
proffs is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 03-27-2016 , 15:13   Re: Turn on/off friendlyfire not working
Reply With Quote #4

It looks like another plugin or somewhere else in your code that is preventing friendly fire. Try changing mp_friendlyfire manually through server console.
__________________
Chaosxk is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-27-2016 , 17:45   Re: Turn on/off friendlyfire not working
Reply With Quote #5

Quote:
Originally Posted by Chaosxk View Post
It looks like another plugin or somewhere else in your code that is preventing friendly fire. Try changing mp_friendlyfire manually through server console.
Yep, check if there is plugin using SDKHooks (not only SDKHooks, but most likely) and hooking+stoping damage.

If you shoot your teammate, is there a blood? If so, it's SDKHook OnTakeDamage, otherwise it's TraceAttack.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
proffs
Senior Member
Join Date: Jul 2013
Old 03-27-2016 , 17:46   Re: Turn on/off friendlyfire not working
Reply With Quote #6

Quote:
Originally Posted by KissLick View Post
Yep, check if there is plugin using SDKHooks (not only SDKHooks, but most likely) and hooking+stoping damage.

If you shoot your teammate, is there a blood? If so, it's SDKHook OnTakeDamage, otherwise it's TraceAttack.
Yes there is blood, I will check for it.
I can tell right now that I'm using SM_hosties might be that?
And how would I fix it?
__________________
proffs is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-27-2016 , 17:50   Re: Turn on/off friendlyfire not working
Reply With Quote #7

As far as I know SM_Hosties doesn't block dmg, at least my TeamGames never had a problem with Hosties and it looks like you are trying to achieve what TG does.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
proffs
Senior Member
Join Date: Jul 2013
Old 03-27-2016 , 17:59   Re: Turn on/off friendlyfire not working
Reply With Quote #8

Quote:
Originally Posted by KissLick View Post
As far as I know SM_Hosties doesn't block dmg, at least my TeamGames never had a problem with Hosties and it looks like you are trying to achieve what TG does.
I'm trying to port over all of my plugins from cs 1.6 server to cs:go, there's a lot of stuff that doesn't work here on cs:go which sucks and right now I'm trying to fix the terrorist games, so I need to turn FF on and off through commands.

Should be another way around this issue?
__________________

Last edited by proffs; 03-28-2016 at 03:12.
proffs is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-27-2016 , 18:13   Re: Turn on/off friendlyfire not working
Reply With Quote #9

I don't see anything that screems "I hook attack". Try to unload your plugin, set "sm_cvar mp_friendlyfire 1" and do some team attacks. Works? problem is in your plugin.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
proffs
Senior Member
Join Date: Jul 2013
Old 03-28-2016 , 04:01   Re: Turn on/off friendlyfire not working
Reply With Quote #10

Quote:
Originally Posted by KissLick View Post
I don't see anything that screems "I hook attack". Try to unload your plugin, set "sm_cvar mp_friendlyfire 1" and do some team attacks. Works? problem is in your plugin.
I used mp_teammates_are_enemies 1 instead and it works now.
How can I hook message and block the "%s has attacked a teammate" message?
__________________
proffs 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 04:12.


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