Personally I hate it when commands use global variables to store these types of things...
/*==========================================
*------------------------------------------*/
static int buildin_getareausers_sub(struct block_list *bl,va_list ap)
{
int *users=va_arg(ap,int *);
struct map_session_data *sd = (TBL_PC *)bl;
struct script_state* st;
st=va_arg(ap,struct script_state*);
if( *users < 128 )
setd_sub(st, NULL, ".@account_ids", *users, (void *)__64BPRTSIZE(sd->status.account_id), NULL);
(*users)++;
return 0;
}
BUILDIN_FUNC(getareausers)
{
const char *str;
int16 m,x0,y0,x1,y1,users=0; //doubt we can have more then 32k users on
str=script_getstr(st,2);
x0=script_getnum(st,3);
y0=script_getnum(st,4);
x1=script_getnum(st,5);
y1=script_getnum(st,6);
if( (m=map_mapname2mapid(str))< 0){
script_pushint(st,-1);
return 0;
}
map_foreachinarea(buildin_getareausers_sub,
m,x0,y0,x1,y1,BL_PC,&users,st);
script_pushint(st,users);
return 0;
}
NPC Example...
prontera,148,177,5 script getareausers 100,{
.@len = getareausers("prontera",148,175,163,164);
for( .@a = 0; .@a < .@len; .@a++ )
npctalk ""+.@account_ids[.@a];
end;
}
Can you transfer this format let it suit for rathena??
http://hercules.ws/board/topic/4593-getmemberaid-checkmes/
I really want this command...