void SetupKillTrackerAI(ScriptMgr * mgr) { QueryResult *result = NULL; result = WorldDatabase.Query("SELECT entry FROM registerai"); uint32 rowstoregister = result->GetRowCount(); sLog.outDetail("%u npcs dynamically registered.", rowstoregister); do { Field *field = result->Fetch(); uint32 npcid = result->Fetch()->GetUInt32(); mgr->register_creature_script(npcid, &KillTracker::Create); sLog.outDetail("Registered AI script for entry %u", npcid); }while(result->NextRow()); delete result; }