you are comparing the distance between me and me which is always 0
you should check out this line: you=players[enet_ent_creator(enet_ent_globpointer(me))]; i think that you want to get the distance to your player in the enemies function so you need to pass the player to enet_ent_globpointer, not me