Jump to content
  • 0

ChatRoom that retrives all the id on it


Question

Posted

is there any way that a chatroom retrives all the ids of the chatroom

 

i dont know how but i saw it on clif.c

 


void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd)
{
int fd;
int i,t;
 
nullpo_retv(sd);
nullpo_retv(cd);
 
fd = sd->fd;
if (!session_isActive(fd))
return;
t = (int)(cd->owner->type == BL_NPC);
WFIFOHEAD(fd, 8 + (28*(cd->users+t)));
WFIFOW(fd, 0) = 0xdb;
WFIFOW(fd, 2) = 8 + (28*(cd->users+t));
WFIFOL(fd, 4) = cd->bl.id;
 
if(cd->owner->type == BL_NPC){
char name[NAME_LENGTH+1];
char *pos;
strcpy(name, ((struct npc_data *)cd->owner)->name);
pos = strchr(name, '#');
if ( pos != NULL )
*pos = '\0';
WFIFOL(fd, 30) = 1;
WFIFOL(fd, 8) = 0;
memcpy(WFIFOP(fd, 12), name, NAME_LENGTH);
for (i = 0; i < cd->users; i++) {
WFIFOL(fd, 8+(i+1)*28) = 1;
memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd->status.name, NAME_LENGTH);
}
} else
for (i = 0; i < cd->users; i++) {
WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC);
memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd->status.name, NAME_LENGTH);
}
WFIFOSET(fd, WFIFOW(fd, 2));
}

8 answers to this question

Recommended Posts

Posted (edited)

[paste=74qo3zthrrcz]

 

-	script	OnPCJoinChatEvent	-1,{
	pc_getwaitingroomlist $@waitingroomowner;
	dispbottom $@waitingroomcount +"";
//	for ( .@i = 0; .@i < $@waitingroomcount; .@i++ )
//		dispbottom ( .@i +1 )+". "+ rid2name( $@waitingroomaid[.@i] );
	announce rid2name( $@waitingroomaid[$@waitingroomcount -1] )+" has join "+ rid2name( $@waitingroomaid[0] ) +"'s waitingroom", bc_all;
	end;
}
I wrote this based on hercules emulator =/

so try convert it into rathena source code

Edited by AnnieRuru
Posted

I've it not tested, but try it like this way.

I don't know what you trying out exactly, so I script only an excample. 

map,x,y,0 script Test Room#IPcheck 837,{
end;
OnInt:
waitingroom "Channel Name",20,"Test Room#IPcheck::OnStart",1;
end;

OnStart:
attachrid($@accountid[0]);
end;
}
Posted (edited)

 

I've it not tested, but try it like this way.

I don't know what you trying out exactly, so I script only an excample. 

map,x,y,0 script Test Room#IPcheck 837,{
end;
OnInt:
waitingroom "Channel Name",20,"Test Room#IPcheck::OnStart",1;
end;

OnStart:
attachrid($@accountid[0]);
end;
}

what i mean if the player is created chat? how to retrive the account_id?

Edited by hakuren
Posted (edited)

[paste=74qo3zthrrcz]

 

-	script	OnPCJoinChatEvent	-1,{
	pc_getwaitingroomlist $@waitingroomowner;
	dispbottom $@waitingroomcount +"";
//	for ( .@i = 0; .@i < $@waitingroomcount; .@i++ )
//		dispbottom ( .@i +1 )+". "+ rid2name( $@waitingroomaid[.@i] );
	announce rid2name( $@waitingroomaid[$@waitingroomcount -1] )+" has join "+ rid2name( $@waitingroomaid[0] ) +"'s waitingroom", bc_all;
	end;
}
I wrote this based on hercules emulator =/

so try convert it into rathena source code

 

 

maam it works now thank you somuch!!!!!!!!!!!!!!!!!!!!!!

Edited by hakuren

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...