fixed an important MATHS error but i get the same errors as before
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init()
{
register_plugin("Invisibilty frags's ratio ","0.2","Tyler")
register_event("Curratio","Set_ratio","b","1=1")
register_cvar("amx_multiplier_invis","18")
register_cvar("amx_min_alphaVal","50")
register_event("distance","set_distance","b",1=1")
return PLUGIN_CONTINUE
}
public set_ratio(id) {
new frags = get_user_frags (id)
new deaths = get_user_deaths (id)
new Float:ratio
// arg deaths cant be equals to 0
if (deaths == 0)
{
return PLUGIN_HANDLED
} else {
return PLUGIN_CONTINUE
}
// ouh fixed it
new Float:multi
new Float:mulratio
multi = get_cvar_float("amx_multiplier_invis")
ratio = float(frags/deaths)
mulratio = floatmul(ratio,multi)
new float:alpha
new minAlphaVal
minAlphaVal = get_cvar_num("amx_min_alphaVal")
alpha = float(minAlphaVal+mulratio)
new alphaVal
alphaVal = floatround(alpha, floatround_round)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)
new name[33]
get_user_name(id,name,32)
set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 1)
show_hudmessage(id,"Visibility: %i ^nRatio: %r",alphaVal,ratio)
return PLUGIN_CONTINUE
}
Public set_distance(id) {
/* Get the distance between two entities */
stock get_entity_distance(ent1, ent2)
{
new Float:orig1[3], Float:orig2[3], origin1[3], origin2[3]
entity_get_vector(ent1, EV_VEC_origin, orig1)
for(new a = 0; a < 3; a++)
origin1[a] = floatround(orig1[a])
entity_get_vector(ent2, EV_VEC_origin, orig2)
for(new b = 0; b < 3; b++)
origin2[b] = floatround(orig2[b])
return get_distance(origin1, origin2)
}
public client_PreThink( id )
{
new players[32], inum
get_players( players, inum, "a" )
for( new i = 0; i < inum; ++i )
{
if( id == players[i] ) continue
if( get_entity_distance(id, players[i]) > 350 )
{
new player
player = get_user_name(players[i])
print_center(id,"Player %p is close to you",player)
}
}
return PLUGIN_CONTINUE
}
return PLUGIN_HANDLED
}