Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
1
Indexable
Never
else if (actual_command == "/bunela") {
    std::vector<std::pair<std::string, int>> players;
    int lock = 0;
json a_ = r_["inv"].get<json>();
    for (auto& p : directory_iterator("players")) {
        json j;
        ifstream files(p.path());
        files >> j;
        for (int i_ = 0; i_ < 100; i_++) {
				itemid = a_.at(i_)["i"].get<int>();
				itemcount = a_.at(i_)["c"].get<int>();
				name = a_.at(i_)["name"].get<string>();
				if (itemid == 242) lock++;
				if (itemid == 1796) lock += 100;
				if (itemid == 7188) lock += 10000;
				players.push_back(std::make_pair(name, lock));
			}

  std::sort(players.begin(), players.end(), [](const std::pair<std::string, int>& a, const std::pair<std::string, int>& b) {
        return a.second > b.second;
    });
string btn = "";
    for (const std::pair<std::string, int>& player : players) {
        btn += "\nadd_smalltext|Player: "+ player.first +" with "+ player.second +" locks|";
    }
    gamepacket_t k;
    k.Insert("OnDialogRequest");
    k.Insert(btn);
    k.CreatePacket(peer);
    }
}