Jump to content
  • 0

whats the syntax for using getareausers


Question

Posted (edited)

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

3 answers to this question

Recommended Posts

  • 1
Posted (edited)

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
  • 0
Posted (edited)

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
  • 0
Posted

 

               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

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...