Quote:
Originally Posted by Arkshine
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)=" );
RegisterHam( Ham_TakeDamage, "player", "PlayerHurt");
//dmg_reduce = register_cvar("vff_ammount", "0.10");
friendlyFire = get_cvar_pointer("mp_friendlyfire");
}
public client_authorized( id )
if( !gBotsRegistered && is_user_bot( id ) )
{
set_task( 0.1, "register_bots", id );
}
public register_bots( id )
{
if( !gBotsRegistered && is_user_connected( id ) )
{
RegisterHamFromEntity( Ham_TakeDamage, id, "PlayerHurt");
gBotsRegistered = true;
}
}
public PlayerHurt( victim, inflictor, attacker, Float:damage, damagebits )
{
if( is_user_connected( attacker ) // 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 * 3 ) * flFFRatio);
}
if( flFFRatio <= 0)
{
SetHamParamFloat(4, 0)
}
if(flFFRatio == 1)
{
SetHamParamFloat(4, damage * 3);
}
if(flFFRatio > 1)
{
SetHamParamFloat(4, damage * 3);
}
}
}