TiMz Posted February 13, 2014 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 192 Reputation: 9 Joined: 05/08/13 Last Seen: August 23, 2024 Share Posted February 13, 2014 (edited) Hello, it it possible to make "getmapusers" not count those using the command @hide, for both gm and normal players. Edited February 14, 2014 by Isaiah Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted February 13, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted February 13, 2014 use iterator to count all players on the map individually search struct s_mapiterator* iter;inside your \src\ folder for ideas Quote Link to comment Share on other sites More sharing options...
TiMz Posted February 14, 2014 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 192 Reputation: 9 Joined: 05/08/13 Last Seen: August 23, 2024 Author Share Posted February 14, 2014 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; } Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted February 14, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted February 14, 2014 int count; .... for ( loop every player ) if ( mapname == str && player not hiding ) count++; ... script_pushint(st,count); Quote Link to comment Share on other sites More sharing options...
TiMz Posted February 14, 2014 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 192 Reputation: 9 Joined: 05/08/13 Last Seen: August 23, 2024 Author Share Posted February 14, 2014 I wish I knew what to put to loop every player. Thanks for the clues though. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted February 15, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted February 15, 2014 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 Quote Link to comment Share on other sites More sharing options...
Question
TiMz
Hello, it it possible to make "getmapusers" not count those using the command @hide, for both gm and normal players.
Edited by IsaiahLink to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.