AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   mp_friendlyfire float and other question (https://forums.alliedmods.net/showthread.php?t=108753)

Doc-Holiday 11-09-2009 03:54

mp_friendlyfire float and other question
 
Ok well i got the second part solved buddy of mine was able to test.

Now just gotta make mp_friendlyfire as a float

Arkshine 11-09-2009 04:07

Re: mp_friendlyfire float and other question
 
Use get_[p]cvar_float().

Doc-Holiday 11-09-2009 04:21

Re: mp_friendlyfire float and other question
 
Quote:

Originally Posted by Arkshine (Post 984852)
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);
        }
    }



Arkshine 11-09-2009 04:50

Re: mp_friendlyfire float and other question
 
mp_friendlyfire is not a ratio...

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

Doc-Holiday 11-09-2009 11:03

Re: mp_friendlyfire float and other question
 
Quote:

Originally Posted by Arkshine (Post 984866)
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.

Arkshine 11-09-2009 11:05

Re: mp_friendlyfire float and other question
 
To retrieve the value as float, use #2.

Doc-Holiday 11-09-2009 11:07

Re: mp_friendlyfire float and other question
 
Quote:

Originally Posted by Arkshine (Post 985013)
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

Arkshine 11-09-2009 11:11

Re: mp_friendlyfire float and other question
 
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_*.


All times are GMT -4. The time now is 17:37.

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