Raised This Month: $ Target: $400
 0% 

mp_friendlyfire float and other question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 11-09-2009 , 03:54   mp_friendlyfire float and other question
Reply With Quote #1

Ok well i got the second part solved buddy of mine was able to test.

Now just gotta make mp_friendlyfire as a float

Last edited by Doc-Holiday; 11-09-2009 at 04:04.
Doc-Holiday is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-09-2009 , 04:07   Re: mp_friendlyfire float and other question
Reply With Quote #2

Use get_[p]cvar_float().
__________________
Arkshine is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 11-09-2009 , 04:21   Re: mp_friendlyfire float and other question
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Use get_[p]cvar_float().
it didn't work when i tried it last time ill post my code see if you can figure out why.

mp_friendlyfire = 0.10

is there a way to set mp_friendlyfire by this plugin since its in amxx not in this plugin

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>


new bool:gBotsRegistered;
new  
friendlyFire;

public 
plugin_init( )
{
    
register_plugin"Variable Friendly Fire""1.4""=(GrG)=" );

    
RegisterHamHam_TakeDamage"player""PlayerHurt");
    
    
//dmg_reduce = register_cvar("vff_ammount", "0.10");
    
    
friendlyFire get_cvar_pointer("mp_friendlyfire");



public 
client_authorizedid )
    if( !
gBotsRegistered && is_user_botid ) )
{
    
    
set_task0.1"register_bots"id );
}

public 
register_botsid )
{
    if( !
gBotsRegistered && is_user_connectedid ) )
    {
        
RegisterHamFromEntityHam_TakeDamageid"PlayerHurt");
        
gBotsRegistered true;
    }
}


public 
PlayerHurtvictiminflictorattackerFloat:damagedamagebits )
{

    if( 
is_user_connectedattacker // Makes sure valid target
    
&&  cs_get_user_team(attacker) == cs_get_user_team(victim)) //Checks if the same team
    
{
        new 
Float:flFFRatio get_pcvar_float(friendlyFire)
        if( 
flFFRatio 0.0 && flFFRatio 1)
        {
            
SetHamParamFloat(4, (damage ) * flFFRatio);
        }
        if( 
flFFRatio <= 0)
        {
            
SetHamParamFloat(40)
        }
        if(
flFFRatio == 1)
        {
            
SetHamParamFloat(4damage 3);
        }
        if(
flFFRatio 1)
        {
            
SetHamParamFloat(4damage 3);
        }
    }

Doc-Holiday is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-09-2009 , 11:05   Re: mp_friendlyfire float and other question
Reply With Quote #4

To retrieve the value as float, use #2.
__________________
Arkshine is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 11-09-2009 , 11:07   Re: mp_friendlyfire float and other question
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
You can't alter a server cvar built with CS. To retrieve the value as float, use #2.
ahh so then my next question is... is there a way to set a cvar that is in cs from a plugin

mp_ff 0.25


if(mp_ff > 0)
mp_friendlyfire 1
Doc-Holiday is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-09-2009 , 04:50   Re: mp_friendlyfire float and other question
Reply With Quote #6

mp_friendlyfire is not a ratio...

It's either 1 or 0. Meaning 1 you can hurt teammates, 0 you can't.
__________________
Arkshine is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 11-09-2009 , 11:03   Re: mp_friendlyfire float and other question
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
mp_friendlyfire is not a ratio...

It's either 1 or 0. Meaning 1 you can hurt teammates, 0 you can't.

right and i need to make it a float.
Doc-Holiday is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-09-2009 , 11:11   Re: mp_friendlyfire float and other question
Reply With Quote #8

I was meant that you can't change the fact that mp_friendlyfire is either 1 or 0 and you can't to turn out it in a float.

For your question, just use #2, but with set_*.
__________________
Arkshine 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 17:37.


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