My code
PHP Code:
public FindClosesEnemy(entid)
{
new Float:Dist
new Float:maxdistance=4000.0
new indexid=0
for(new i=1;i<=g_iMaxPlayers;i++)
{
if(is_user_alive(i) || is_user_bot(i) && is_valid_ent(i) && can_see_fm(entid, i))
{
Dist = entity_range(entid, i)
if(Dist <= maxdistance)
{
maxdistance=Dist
indexid=i
return indexid
}
}
}
return 0
}
Why is always return indexid = 1
and i saw that when i change new i=1 with another number new i=5 indexid will be returned like 5
Please help me .Thank You