Jump to content
  • 0

R> "getmapusers" ignore @hide


Question

Posted (edited)

Hello, it it possible to make "getmapusers" not count those using the command @hide, for both gm and normal players.

Edited by Isaiah

5 answers to this question

Recommended Posts

Posted

I tried doing it this way yet  @hide is still being counted.

BUILDIN_FUNC(getmapusers)
{
	const char *str;
	int m;
	str=script_getstr(st,2);
	if( (m=map_mapname2mapid(str))< 0){
		script_pushint(st,-1);
		return 0;
	}
	TBL_PC *sd, *pl_sd;
	struct s_mapiterator* iter;
	iter = mapit_getallusers();
	for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
	if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_isinvisible(pl_sd))
					continue; // skip hidden GMs (with !hide)

	script_pushint(st,map[m].users);
	return 0;
}
Posted

BUILDIN(getmapusers) {

struct map_session_data *pl_sd;

struct s_mapiterator* iter = mapit_getallusers();

int m = map->mapname2mapid( script_getstr(st,2) ), count = 0;

if ( m < 0 ) {

script_pushint( st, -1 );

return true;

}

for ( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )

if ( pl_sd->bl.m == m && !( pl_sd->sc.option & OPTION_INVISIBLE ) )

count++;

script_pushint( st, count );

return true;

}

have fun convert this from hercules into rathena

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...