WarCraft: Source

 

NearCoord

Page history last edited by freddukes@... 1 yr ago

Near Coord


This command tests 2 sets of co-ords, to see if 1 is in range of another. The first set of co-ords is where you want the co-ord range to be tested from, the second set is the player that its testing to check...

Note: For this to work, the player being check MUST be inside all three ranges... e.g. The players X position must be in the X range from the X starting co-ord, same goes for Y and Z

 

The correct syntax is:

 

wcs.Command(<userid>).NearCoord(<x origin>, <y origin>, <z origin>, <x range>, <y range>, <z range>, <call-back function>, [Optional: identifier])

 

  • Userid - If you're running the near coord from for example a skill that's created by the userid, then that would be the userid... It's the person 'running' the command
  • X, Y, Z origin - The co-ordinates the the ranges will be tested from
  • X, Y, Z range - The range of which the users will have to be inside to return the call-back function
  • Call-back function - Every userid inside the range will activate this function
  • Optional: Identifier - The target/Group of people that will be test; if none given, it will test all:
    • #all - all players
    • #ct - counter-terrorists
    • #t - terrorists
    • #spec - spectators
    • #un - unassigned (people who never joined a team or spec after connecting)
    • #dead - dead players
    • #alive - living players
    • #human - real players
    • #bot - bots

 


 

Example:

 

my_list = []

# Creates a list

 

def player_say(ev):

    if ev["text"] == "test":

        wcs.Command(ev["userid"]).NearCoord(0, 0, 0, 250, 250, 500, AddToList)

        # Run the command, with the call-back function of AddToList

        es.tell(ev["userid"],"#green","There are %s Players within 250 X units, 250 Y units and 500 Z units of the origin of the map"%len(my_list))

        # Tell the user how many people are in 250,250,500 range of the origin of the map

 

def AddToList(userid, attacker):

    my_list.append(userid)

    # Add the user's ID  to the list

 

Comments (0)

You don't have permission to comment on this page.