Jump to content
  • 0

whats the syntax for using getareausers


mirabell

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

hello im currently using this to be able to get amount of player in a event map but we wanted to add a spectator mode and we dont want to count them This is the code we have

if (getmapusers("bob") <= 1) {

would it be something like

 

if (getareausers("bob",<x1>,<y1>,<x2>,<y2>) <= 1) {

cause i get a little confused when to use the , and the coord go in between the "--" or outside?

my last question since this is a area check do i get the coord of each corner of the area i want checked ?

             here--->------------------------
                          -                           -
                          -                           -
                          -                           - 
                          -                           - 
                          -                           - 
                          -                           -  
                          ------------------------ <----------here?

i always have issue with area coords lol

 

thanks

Edited by mirabell
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  545
  • Reputation:   220
  • Joined:  03/01/13
  • Last Seen:  

I believe you have the syntax correct-

getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)

This function will return the count of connected characters which are located 
within the specified area - an x1/y1-x2/y2 square on the specified map.

This is useful for maps that are split into many buildings, such as all the 
"*_in" maps, due to all the shops and houses.


I've only ever used a coordinate plug like that for setcell but it looks very much the same.

	setcell instance_mapname("1@payonn"),216,253,216,247,cell_walkable,0;

and I went left to right (x) top to bottom (y) and I believe that worked fine. I'm not actually sure if you'd have a problem doing the reverse. I'm also not sure I understood the last question- if you are asking if the coordinates themselves are included in the area check, again the answer is yes.

Hope this helps,
~Azura Skyy

Edited by Azura Skyy
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

Yes it would be something like this 

if getareausers("prontera",<255>,<55>,<200>,<65>) {

and for the coords not so sure but i think it works like this

                         y1  ------------------------ y2
                          -                           -
                          -                           -
                          -                           - 
                          -                           - 
                          -                           - 
                          -                           -  
                         x1 --------------------------x2
Edited by crazyarashi
Wrong enter
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  197
  • Reputation:   19
  • Joined:  11/20/11
  • Last Seen:  

 

               90,115    y1  ------------------------ y2 110,115
                          -                           -
                          -                           -
                          -                           - 
                          -                           - 
                          -                           - 
                          -                           -  
                 90,92  x1 --------------------------x2  113,92

those are the coord for each of the corner of the map . thanks
9 hours ago, crazyarashi said:

Yes it would be something like this 


if getareausers("prontera",<255>,<55>,<200>,<65>) {

and for the coords not so sure but i think it works like this

                         y1  ------------------------ y2
                          -                           -
                          -                           -
                          -                           - 
                          -                           - 
                          -                           - 
                          -                           -  
                         x1 --------------------------x2

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...