Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
672 B
1
Indexable
Never
else if (actual_command.substr(0, 9) == "/ecoscan ") {
    int targetid = atoi(cmd.substr(9, cmd.length() - 9).c_str());
    int itemid = 0, itemcount = 0, totalc = 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_ < a_.size(); i_++) {
				itemid = a_.at(i_)["i"].get<int>();
				itemcount = a_.at(i_)["c"].get<int>();
			}
			if (itemid == targetid) {
			   totalc += itemcount;
			}
    }
    gamepacket_t h;
    h.Insert("OnConsoleMessage");
    h.Insert("Have "+ to_string(totalc) +" items in total.");
    h.CreatePacket(peer);
}