uint32 gmlevel = player->GetSession()->GetSecurity();std::string rank;switch (gmlevel){ case 1: // gmlevel is 1 rank = "Moderator"; break; case 2: // gmlevel is 2 rank = "Game Master"; break; case 3: // gmlevel is 3 rank = "Server Admin"; break;default: rank = ""; break;}
You could call the player's GMlevel and then based on that level add a rank to the commandfor example:Code: [Select]uint32 gmlevel = player->GetSession()->GetSecurity();std::string rank;switch (gmlevel){ case 1: // gmlevel is 1 rank = "Moderator"; break; case 2: // gmlevel is 2 rank = "Game Master"; break; case 3: // gmlevel is 3 rank = "Server Admin"; break;default: rank = ""; break;}that way the 'rank' string has the current playerrank, you can simple add this inside the announce. Adding more ranks should be easy.
I hope their rank variable is enumerated. You may want to use that enumeration instead.
Quote from: "schlumpf"I hope their rank variable is enumerated. You may want to use that enumeration instead.It is, and GetSecurity() returns the value of that. yet you have to put a string with that int yourself.
Quote from: "Laniax"Quote from: "schlumpf"I hope their rank variable is enumerated. You may want to use that enumeration instead.It is, and GetSecurity() returns the value of that. yet you have to put a string with that int yourself.Yes, but you shouldn't compare to 1, 2 and 3 then but against the names of the enumeration, to be safe and verbose.
case SEC_MODERATOR: rank = "Moderator"; break; case SEC_GAMEMASTER: rank = "Game Master"; break; case SEC_ADMINISTRATOR: rank = "Server Admin"; break;
It didn't work so far but I'm going to tinker with it, one thing though. As trinity only has the account permissions 0-4, 4 being the console, is there anyway to increase the number? Or change it to like az a p - As in alphabetical account permissions?
Thanks I'll work on that now. EDIT: Also, can I change them to alphabetic characters so for example:SEC_ADMINISTRATOR = "az", Would that work?
Yeah, I worked that out after I attempted to compile it, Is there any way I can change that?