Jump to content
  • 0

R> "getmapusers" ignore @hide


TiMz

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  192
  • Reputation:   9
  • Joined:  05/08/13
  • Last Seen:  

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

Edited by Isaiah
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

use iterator to count all players on the map individually

search

struct s_mapiterator* iter;
inside your \src\ folder for ideas
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  192
  • Reputation:   9
  • Joined:  05/08/13
  • Last Seen:  

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;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

int count;

....

for ( loop every player )

if ( mapname == str && player not hiding )

count++;

...

script_pushint(st,count);

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  192
  • Reputation:   9
  • Joined:  05/08/13
  • Last Seen:  

I wish I knew what to put to loop every player. Thanks for the clues though. /sob

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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