SA-MP Forums Archive
Why this is not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why this is not working? (/showthread.php?tid=182567)



Why is this not working? - JulietaZ - 11.10.2010

IT instant kills ME, its not even necesary to be lesser than 2 meeters..it ignores the distance and everything,...Its like the getclosestplayer detecs myself as a different player....I tried if target != playerid then do the damage, but then it does nothing, even when im closer the player

forward asd(playerid);
public asd(playerid)
{

new target = GetClosestPlayer(playerid);
new Float:dist = GetDistanceBetweenPlayers(playerid,target);

if( dist < 2)
{
SetPlayerHealth(target,0);
}

}