[SOLVED]How to add a player to a group using c++

Hello, i’m trying to add a player to a group, but i’m having troubles. I’m new to modifying the core /emoticons/default_smile.png

  1. how to get a group guid from the database if I know the Leader’s name

  2. how to add a player by name to that group

i’m playing with CharacterDatabase.PExecute(“INSERT INTO group_member (guid, memberGuid, memberFlags, subgroup, roles) VALUES(x, x, 0, 0, 0)”); but i have no luck /emoticons/default_sad.png. I must reload the emu for this to work, so i can’t use this

and some of

Group* grp = NULL;

Player* target;

uint64 target_guid;

std::string target_name;

if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))

return false;



Nevermind this request…i found the solution on my own /emoticons/default_smile.png 10x

grp->AddMember(target_guid, target_name);

Not sure if this is right, but I saw this in the script playerbot think can help. (See more in https://raw.github.com/thedevnull/thedevnull-patches/master/11010-independent/0001-bots.patch)



10x for the reply, this is my final code if enyone is interested, it works 100%

bool ChatHandler::HandleRaidJoinCommand(const char* args)


Player* player = m_session->GetPlayer();

Player* plr = NULL;

Group* group = NULL;

uint64 guid = 0;

char* cname = strtok((char*)args, " ");

if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid))

if (group)





return true;


— Canned message start

It appears the issue in the original post was solved, so this thread shall be closed. Should you encounter any other difficulties, please open a new thread.

— Canned message end —