Issue information

Issue ID
#3330
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Jul 2, 2009 20:05
Last Post
Hercules Elf Bot
Jul 2, 2009 20:05
Confirmation
N/A

Hercules Elf Bot - Jul 2, 2009 20:05

Originally posted by [b]SilverPhoenix[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3330

The script command waitingroom2bg should accept a 6th parameter (optional) as npcname to take the waitingroom from but in the source the 7th parameter is supposed to be used for that (which is not allowed), therefore it doesn't work.

script.c (command definition)
QUOTE
BUILDIN_FUNC(waitingroom2bg)
{
struct npc_data *nd;
struct chat_data *cd;
const char *map_name, *ev = "", *dev = "";
int x, y, i, mapindex = 0, bg_id, n;
struct map_session_data *sd;

if( script_hasdata(st,8) )
nd = npc_name2id(script_getstr(st,8));
else
nd = (struct npc_data *)map_id2bl(st->oid);

if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
{
script_pushint(st,0);
return 0;
}

map_name = script_getstr(st,2);
if( strcmp(map_name,"-") != 0 )
{
mapindex = mapindex_name2id(map_name);
if( mapindex == 0 )
{ // Invalid Map
script_pushint(st,0);
return 0;
}
}

x = script_getnum(st,3);
y = script_getnum(st,4);
ev = script_getstr(st,5); // Logout Event
dev = script_getstr(st,6); // Die Event

if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 )
{ // Creation failed
script_pushint(st,0);
return 0;
}

n = cd->users;
for( i = 0; i < n && i < MAX_BG_MEMBERS; i++ )
{
if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) )
mapreg_setreg(add_str("$@arenamembers") + (i<<24), sd->bl.id);
else
mapreg_setreg(add_str("$@arenamembers") + (i<<24), 0);
}

mapreg_setreg(add_str("$@arenamembersnum"), i);
script_pushint(st,bg_id);
return 0;
}


script.c (command declaration)
CODE
BUILDIN_DEF(waitingroom2bg,"siiss?"),


The 8 (red) should be a 7.

This post has been edited by SilverPhoenix: Jul 2 2009, 01:06 PM