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 , 04:21   Re: mp_friendlyfire float and other question
Reply With Quote #1

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
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