Jump to content

  •  

Klutz

Member Since 25 May 2013
Offline Last Active Jun 03 2017 09:07 AM
-----

#81775 getmapusers - More options

Posted by Klutz on 16 April 2017 - 09:54 PM

Lately i been working to switch from eAthena server to Hercules.

with all the new functions Hercules has i started to build new scripts for my npcs.

 

i found myself searching a lot for lists:

1) Name of people on specific map.

2) Char ID of people on specific map.

3) Account ID of people on specific map.

 

BUILDIN(getmapusers) {
	int16 m;
	int type = 0;
	int users = 0;
	struct s_mapiterator* iter;
	struct map_session_data *sd;
	const char *str;
	str = script_getstr(st,2);
	if( (m=map->mapname2mapid(str))< 0) {
		script_pushint(st,-1);
		return true;
	}
	if (script_hasdata(st,3))
		type = script_getnum(st,3);
	else{
		script_pushint(st,map->list[m].users);
		return true;
	}
	iter = mapit_getallusers();
	for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
		if (sd->bl.m == m){
			switch (type)
			{
				case 1:
					mapreg->setregstr(reference_uid(script->add_str("$@mapcharname$"), users), sd->status.name);
					break;
				case 2:
					mapreg->setreg(reference_uid(script->add_str("$@mapcharid"), users), sd->status.char_id);
					break;
				case 3:
					mapreg->setreg(reference_uid(script->add_str("$@mapaccountid"), users), sd->status.account_id);
					break;
			}
			users++;
		}
	}
	mapit->free(iter);
	return true;
}



BUILDIN_DEF(getmapusers,"s?"),

 

 

 

 

 

I was wondering if you want to add it to Hercules as a new feature.

 

Regards,

Klutx




#81467 Map server errors

Posted by Klutz on 03 April 2017 - 08:59 PM

Hey,
 
I get some map server errors using Arrow shower skill:
 
Facts:
 
1) Happens when you use arrow shower on a trap.
2) The trap doesn't get pushed away.
3) Doesn't Happens when you use arrow shower on a monster, a Player or empty spot.
4) i replaced all my source edits (skill.c and battle.c) with the files from the git - > Doesn't solve the problem.
5) i am using pre-re settings.
6) i am running latest Hercules.
7) Only plugin that is being used is db2sql.
 
The Error:
 
[Error]: --- nullpo info --------------------------------------------
[Error]: skill.c:12185: 'bst' in function `skill_unit_onplace_timer'
[Error]: ./map-server(assert_report+0x80) [0x6435a0]
[Error]: ./map-server(skill_unit_onplace_timer+0x419) [0x5c5609]
[Error]: ./map-server(skill_unit_timer_sub_onplace+0xc9) [0x5ced19]
[Error]: ./map-server() [0x50b8dd]
[Error]: ./map-server(map_vforeachinshootrange+0x99) [0x516559]
[Error]: ./map-server(map_foreachinshootrange+0x97) [0x514fc7]
[Error]: ./map-server(skill_unit_timer_sub+0x2b3) [0x5d2ee3]
[Error]: ./map-server() [0x63a5ca]
[Error]: ./map-server() [0x639c42]
[Error]: ./map-server(skill_unit_timer+0x36) [0x5cee36]
[Error]: --- end nullpo info ----------------------------------------
 
 
Thanks in advance,
Klutz