TiMz Posted February 13, 2014 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
AnnieRuru Posted February 13, 2014 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
TiMz Posted February 14, 2014 Author 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
AnnieRuru Posted February 14, 2014 Posted February 14, 2014 int count; .... for ( loop every player ) if ( mapname == str && player not hiding ) count++; ... script_pushint(st,count); Quote
TiMz Posted February 14, 2014 Author Posted February 14, 2014 I wish I knew what to put to loop every player. Thanks for the clues though. Quote
AnnieRuru Posted February 15, 2014 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
Question
TiMz
Hello, it it possible to make "getmapusers" not count those using the command @hide, for both gm and normal players.
Edited by Isaiah5 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.