All pastes #954199 Raw Edit

Miscellany

public cpp v1 · immutable
#954199 ·published 2008-03-23 19:15 UTC
rendered paste body
uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type){    // need fix it!    QueryResult *result = CharacterDatabase.PQuery("SELECT arenateamid FROM arena_team_member WHERE guid='%u'", GUID_LOPART(guid));    if(result)    {        // init id to find the type of the arenateam        uint32 id = (*result)[0].GetUInt32();        do        {            QueryResult *result2 = CharacterDatabase.PQuery("SELECT type FROM arena_team WHERE arenateamid='%u'", id);            if(result2)            {                uint8 dbtype = (*result2)[0].GetUInt32();                delete result2;                if(dbtype == type)                {                    // if the type matches, we've found the id                    break;                }            }        } while(result->NextRow());        delete result;        return id;    }    // no arenateam for the specified guid, return 0    return 0;}