Jump to content

Find player by character name on server


Recommended Posts

  • Management

Hello,

How can I find a player on server having only the character name?

I know the CHARACTER_MANAGER::instance().FindPC(), but it only works if the player is online and on the same map that the user that searched it. Is there a way to find in the whole server? And check if is online or offline?

The objective is when the player is if the player is online it sends a chat message saying that the account has been banned and disconnects, if is not online, it only bans.

Thanks

  • Love 1

raw

raw

Link to comment
Share on other sites

  • Management

The problem is, how do I check if the player is online or not?

The functions I know only detect if player is in the same map or not...

I'm using this one at the moment: 

LPCHARACTER pkbanned = CHARACTER_MANAGER::instance().FindPC(username);
LPCHARACTER CHARACTER_MANAGER::FindPC(const char * name)
{
	char szName[CHARACTER_NAME_MAX_LEN + 1];
	str_lower(name, szName, sizeof(szName));
	NAME_MAP::iterator it = m_map_pkPCChr.find(szName);

	if (it == m_map_pkPCChr.end())
		return NULL;

	// <Factor> Added sanity check
	LPCHARACTER found = it->second;
	if (found != NULL && strncasecmp(szName, found->GetName(), CHARACTER_NAME_MAX_LEN) != 0) {
		sys_err("[CHARACTER_MANAGER::FindPC] <Factor> %s != %s", name, found->GetName());
		return NULL;
	}
	return found;
}

If I'm not in Channel 99 (for example, in OX Map) and I send the band to a player on Channel 1 it doesn't find, how can I do that?

 

raw

raw

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.