Jump to content
  • 0

weird map after being kicked using @reportafk in BG


nermit

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.08
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/26/24
  • Last Seen:  

Hello, i'm still new to Ragnarok coding and have decided to fiddle with Battlegrounds.
The current server im looking at is using modified bg and has a @reportafk  command that kicks and afk player.

It does work, but the on the kicked-player's client it is black screen/or current BG map with all the NPC's on the main town.


below is the code at src/custom/atcommand.inc

ACMD_FUNC(reportafk)
{
	map_session_data *pl_sd;
	nullpo_retr(-1,sd);
	if( !sd->bg_id )
		clif_displaymessage(fd, msg_txt(sd, 2029)); // This command is reserved for Battleground
	else if( !sd->bmaster_flag && battle_config.bg_reportafk_leaderonly )
		clif_displaymessage(fd, msg_txt(sd, 2014)); // This command is reserved for Team Leaders.
	else if( !message || !*message )
		clif_displaymessage(fd, msg_txt(sd, 2030)); // Please enter the AFK player's nick (usage: @reportafk <name>).
	else if( (pl_sd = map_nick2sd((char *)message,false)) == NULL )
		clif_displaymessage(fd, msg_txt(sd,3)); // Character not found.
	else if( sd->bg_id != pl_sd->bg_id )
		clif_displaymessage(fd, msg_txt(sd,2026)); // The player is not part of your Team.
	else if( sd == pl_sd )
		clif_displaymessage(fd, msg_txt(sd,2031)); // You cannot report yourself.
	else if( pl_sd->state.bg_afk == 0 )
		clif_displaymessage(fd, msg_txt(sd,2032)); // The player is not AFK in this Battleground
	else { // Everytest OK!
		std::shared_ptr<s_battleground_data> bg = util::umap_find(bg_team_db, sd->bg_id);
		if(!bg)
			return -1;

		bg_team_leave(pl_sd, true, true);
		clif_displaymessage(pl_sd->fd, msg_txt(sd,2001)); // You have been kicked from Battleground for your AFK status
		pc_setpos(pl_sd,mapindex_name2id(pl_sd->status.save_point.map),pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_OUTSIGHT);
		clif_refresh(pl_sd);

		sprintf(atcmd_output, msg_txt(sd, 2034), pl_sd->status.name); // - AFK [%s] Kicked -
		clif_broadcast2(&sd->bl, atcmd_output, (int)strlen(atcmd_output)+1, bg->color, 0x190, 20, 0, 0, BG);
		return 0;
	}
	return -1;
}

A. [Kicked player's Client]
image.png.e0adeb79870dc8f75b5ddb9149d3e6d2.png

B. Kicked player's Client vs Another player's view

image.thumb.png.609f36bb7829b04dcdb6be7c2edd9bf1.png

 

Any ideas why this is happening? any help will be much appreciated

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.

×
×
  • Create New...