Jump to content

Custom Command And Table


Recommended Posts

Posted

hi there i was bored and decides to make a tele command that could b used by all players but the locations for the command could only be used by some picked players. like having a private area ingame for just some players and another private area for some others.

so what i did was i got the tele command and also make a copy of the tele table in the database and in the table i added some more coloumns for the account id's of the players who are allowed to goto that location. only thing is i got it to compile fully and the server starts but when i use the command even if the account id of the character im on is not in the list of allowed ones it still allows me to teleport to the place.

right now in the table i have set the columns for the account id's to bigint 20 which is the same as id in realmd.account and the code im using to check is the following bits

int64 account_1 = fields[5].GetUInt64(); //after getting result from database
int64 playersid = _player->GetOwnerGUID(); //gets account id of character

if (playersid != account_1)
{
               return false;
}

can someone please tell me why this isn't working and also i dont no if GetOwnerGUID() is the correct thing to use to get the account id of the character.

Posted

Use uint32 for players account..

Then use fields[5].GetUInt32(); not fields[5].GetUInt64(); .

Then for get player's account, if player is online and if he used command use this code

Player* pl = m_session->GetPlayer();
uint32 playersid = pl->GetSession()->GetAccountId();

×
×
  • Create New...

Important Information

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. Privacy Policy Terms of Use