Raised This Month: $ Target: $400
 0% 

Why this function dont work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheArmagedon
Senior Member
Join Date: Sep 2010
Location: Unknown Source
Old 12-05-2011 , 11:17   Why this function dont work?
Reply With Quote #1

Im trying to do a simple function, if FF is on then CTs cant kill other CTs...

but it dont work..
look at my code.. whats is wrong? or what i need to do?
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

new bool:ffon;

public 
plugin_init() {
    
register_clcmd("say /friendlyfire""Blablabla")
    
RegisterHam(Ham_TakeDamage"player""dmgevent"
}
public 
dmgevent(victiminflictorattackerFloat:damagebits
{
    
    if(
ffon && cs_get_user_team(attacker) == CS_TEAM_CT && cs_get_user_team(victim) == CS_TEAM_CT) {
        
// return HAM_SUPERCEDE
        // dont work
        // SetHamParamFloat(4, damage = 0.0)
        // dont work
    
}
    
// or
    
new CsTeams:iTeamACsTeams:iTeamV
    iTeamA 
cs_get_user_team(attacker)
    
iTeamV cs_get_user_team(victim)
    
    if(
ffon && iTeamA == CS_TEAM_CT && iTeamV == CS_TEAM_CT)
    {
        
// return HAM_SUPERCEDE
        // dont work
        // SetHamParamFloat(4, damage = 0.0)
        // dont work.....
    
}
    
// the two ways dont work!
}
public 
Blablabla(id)
{
    
ffon = !ffon
    
    
if(ffon) {
        
set_cvar_num("mp_friendlyfire"1)
        
client_print(0print_chat"FF ON");
    } else {
        
set_cvar_num("mp_friendlyfire"0)
        
client_print(0print_chat"FF OFF");
    }

TheArmagedon is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-05-2011 , 17:32   Re: Why this function dont work?
Reply With Quote #2

Quote:
Originally Posted by TheArmagedon View Post
if FF is on then CTs cant kill other CTs...
That's how FF works already. You just need to change the value of mp_friendlyfire. The server will do the rest of the work for you.
__________________
fysiks is offline
TheArmagedon
Senior Member
Join Date: Sep 2010
Location: Unknown Source
Old 12-05-2011 , 20:58   Re: Why this function dont work?
Reply With Quote #3

I forgot to explain a thing...
If FF is on, CTs cant kill CTs and Ts can kill Ts.

If i'm a terrorist and a person says "/friendlyfire" friendlyfire will activate/desactivate., then i can kill my friends, otherwise, Im a ct and friendlyfire is ON...then i cant kill the other cts..

I dont know, but.. do you mean the mp_friendlyfire cvar have more options than 1 or 0?
anything like that..? for example:
mp_friendlyfire 2 - set friendly fire only for terrorists
mp_friendlyfire 3 - set friendly fire only for cts
TheArmagedon is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-05-2011 , 21:08   Re: Why this function dont work?
Reply With Quote #4

in your case, you don't have to check mp_friendlyfire is on or off, just make cts can't take damage of cts.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-05-2011 , 21:59   Re: Why this function dont work?
Reply With Quote #5

If mp_friendlyfire is 0 then nobody can kill their teammates. You have to leave friendlyfire on then handle the damage.
__________________
fysiks is offline
TheArmagedon
Senior Member
Join Date: Sep 2010
Location: Unknown Source
Old 12-06-2011 , 08:00   Re: Why this function dont work?
Reply With Quote #6

Quote:
Originally Posted by jim_yang View Post
in your case, you don't have to check mp_friendlyfire is on or off, just make cts can't take damage of cts.
I already tried that... dont work ):
Quote:
Originally Posted by fysiks View Post
If mp_friendlyfire is 0 then nobody can kill their teammates. You have to leave friendlyfire on then handle the damage.
"If mp_friendlyfire is 0 then nobody can kill their teammates." Yes, i know that but you say after this, "you have to leave friendlyfire on then handle the damage", Thats what i'm trying to do but, i dont know why... it dont work
TheArmagedon is offline
Snaker beatter
Veteran Member
Join Date: Sep 2011
Location: Manila, Philippines
Old 12-06-2011 , 06:31   Re: Why this function dont work?
Reply With Quote #7

Try this anyway UNTESTED
PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich> 

new bool:ffon

public 
plugin_init() { 
    
register_clcmd("say /friendlyfire""Blablabla"
    
RegisterHam(Ham_TakeDamage"player""dmgevent")  

public 
dmgevent(victiminflictorattackerFloat:damagebits)  

     
    if(
ffon && cs_get_user_team(attacker) == CS_TEAM_CT && cs_get_user_team(victim) == CS_TEAM_CT) { 
        
SetHamParamFloat(4damage 0.0
        return 
HAM_SUPERCEDE 
    

    
// or 
    
new CsTeams:iTeamACsTeams:iTeamV 
    iTeamA 
cs_get_user_team(attacker
    
iTeamV cs_get_user_team(victim
     
    if(
ffon && iTeamA == CS_TEAM_CT && iTeamV == CS_TEAM_CT
    { 
        
SetHamParamFloat(4damage 0.0
        return 
HAM_SUPERCEDE 
    

    
// the two ways dont work! 

public 
Blablabla(id

    
ffon = !ffon 
     
    
if(ffon) { 
        
set_cvar_num("mp_friendlyfire"1
        
client_print(0print_chat"FF ON"); 
    } else { 
        
set_cvar_num("mp_friendlyfire"0
        
client_print(0print_chat"FF OFF"); 
    } 

__________________

Last edited by Snaker beatter; 12-06-2011 at 06:31.
Snaker beatter is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-06-2011 , 07:35   Re: Why this function dont work?
Reply With Quote #8

what's the point of SetHamParamX before return HAM_SUPERCEDE
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang 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 11:58.


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