View Single Post
  #2  
Old 10-12-2015, 03:44 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I'm assuming that it's crashing, or at least letting the bot in?


As far as the code..try this:
Code:
void Bot::ProcessBotGroupInvite(Client* c, std::string botName) {
	if(c) {
		Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName);

		if(invitedBot && !invitedBot->HasGroup()) {
			if(!c->IsGrouped()) {
				Group *g = new Group(c);
				if(AddBotToGroup(invitedBot, g)) {
					entity_list.AddGroup(g);
					database.SetGroupLeaderName(g->GetID(), c->GetName());
					g->SaveGroupLeaderAA();
					database.SetGroupID(c->GetName(), g->GetID(), c->CharacterID());
					database.SetGroupID(invitedBot->GetCleanName(), g->GetID(), invitedBot->GetBotID());
				}
			} else {
				// godrage
				for (int i = 0; i < 6; ++i)
				{
					if (!c->GetGroup()->members[i])
						continue;
						
					if (c->GetGroup()->members[i]->GetClass() == invitedBot->GetClass())
					{
						c->Say("It's all about diversity...");
						return;
					}
				}
								
				AddBotToGroup(invitedBot, c->GetGroup());
				database.SetGroupID(invitedBot->GetCleanName(), c->GetGroup()->GetID(), invitedBot->GetBotID());
			}
		}
	}
}

That's off the cuff..so, I don't know if it works.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote