Raised This Month: $ Target: $400
 0% 

Distance between..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B.A.N.G.E.R.S
Member
Join Date: Sep 2007
Old 06-22-2008 , 04:44   Re: Distance between..
Reply With Quote #1

You could look at the hero psylocke which calculate the amount of inches to the nearest enemy. It's also very clean...

Url = http://forums.alliedmods.net/showthread.php?t=30276

I believe what you are interested in is something like this:
Code:
 
  idTeam = cs_get_user_team(id)
  get_user_origin(id, Origin)
 
  //Anyone closer than this is within 30 meters
  closestEnemy = 1201
 
  for (e = 0; e < pnum; e++) {
   enemy = players[e]
 
   if ( idTeam == cs_get_user_team(enemy) ) continue
   get_user_origin(enemy, eOrigin)
   closestEnemy = min(closestEnemy, get_distance(eOrigin, Origin))
 
  }
 
  if ( closestEnemy == 1201 ) continue
 
  // get_distance() returns inches and 1 inch = 0.0254 meters
  switch(floatround(closestEnemy * 0.0254))
B.A.N.G.E.R.S is offline
Xel0z
Senior Member
Join Date: Apr 2006
Location: Netherlands
Old 06-23-2008 , 06:59   Re: Distance between..
Reply With Quote #2

Ty, though I already found out by looking in another script xD. But thanks for the help, +k u (when I can again).
__________________
Heroes: TESS-One Working on: Grit (Fixing bugs)
Xel0z is offline
Send a message via MSN to Xel0z
B.A.N.G.E.R.S
Member
Join Date: Sep 2007
Old 06-23-2008 , 13:05   Re: Distance between..
Reply With Quote #3

No problem and thank you for the karma (green again at last).
B.A.N.G.E.R.S is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode