ID:264229
 
// Radar Demo v2 (25/06/04)  - By Malver
proc/Update_Radar()
for(var/client/C) // Loop through all non-npc players...
if(C.radar)
var/icon/R = icon('Radar_Blips.dmi',"Radar") // Create an icon to draw on
R.DrawBox(rgb(0,128,0),0,0,32,32) // Clear the radar icon with a dark-ish green
R.DrawBox(rgb(255,255,255), 17, 17-3, 17, 17+3)
R.DrawBox(rgb(255,255,255), 17-3, 17, 17+3, 17)
for(var/mob/M in world) // Search through all of the mobs...
if(get_dist(C.mob,M) < 20 && C.mob.z == M.z && C.mob != M) // If the mob is within 10 squares of the player, is on the same z level, and isn't itself (don't want to place yourself on it, do you?)
var/x = 16-(C.mob.x - M.x)+1
var/y = 16-(C.mob.y - M.y)+1
R.DrawBox(M.team, x-1, y-1, x+1, y+1) // Draw the blip at the proper x/y coordinates
C.radar.icon = R // Set the new icon onto the radar
spawn(5)
Update_Radar() // Refresh the radar every 1/2 second (feel free to play with the update speed!)

You really shouldn't edit demo code unless you know what you're doing.