Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.7 kB
2
Indexable
Never
void world_menu(ENetPeer* peer) {
	long long time_now = time(nullptr);
	int wa_c = 0, sa_c = 0, neta_ = 0, aa = 0;
	if (last_active_update - time_now <= 0 or active_worlds.size() < 5) {
		last_active_update = time_now + 60; // 60 tai 1min
		active_worlds.clear();
		for (int i_ = 0; i_ < worlds.size(); i_++) {
			World world_ = worlds.at(i_);
			/*	if (world_.nuked or not check_name(peer, world_.name)) {
					continue;
				}*/
			if (find(active_worlds.begin(), active_worlds.end(), world_.name) == active_worlds.end()) active_worlds.push_back(world_.name);
		}
	}
	string recently_visited = "", c_active_worlds = "";
	//"\nadd_floater|Random World|0|0.5|2915716095
	int w_c2 = 0, s_c2 = 0, net_2 = 0, a2 = 0;
	get_players("MARKET", w_c2, s_c2, net_2, a2);

	int w_c3 = 0, s_c3 = 0, net_3 = 0, a3 = 0;
	get_players("START", w_c3, s_c3, net_3, a3);

	int w_c4 = 0, s_c4 = 0, net_4 = 0, a4 = 0;
	get_players("CASINO", w_c4, s_c4, net_4, a4);

	int ck = 0;
	c_active_worlds = "\nadd_floater|START|" + to_string(w_c3) + "|0.6|2915716095\nadd_floater|MARKET|" + to_string(w_c2) + "|0.6|2915716095\nadd_floater|CASINO|" + to_string(w_c4) + "|0.6|2915716095";
	for (auto it = pInfo(peer)->last_visited_worlds.rbegin(); it != pInfo(peer)->last_visited_worlds.rend(); ++it) {
		if (find(active_worlds.begin(), active_worlds.end(), *it) == active_worlds.end() && ck < 3) {
			int w_c = 0, s_c = 0, net_ = 0, a = 0;
			get_players(*it, w_c, s_c, net_, a);
			recently_visited += "\nadd_floater|" + *it + "|" + to_string(w_c) + "|0.5|3417414143";
			ck++;
		}
	} 
	for (int i_ = 0; i_ < active_worlds.size(); i_++) {
		string name_ = active_worlds.at(i_);
		vector<World>::iterator p = find_if(worlds.begin(), worlds.end(), [name_](const World& a) { return a.name == name_; });
		if (p != worlds.end()) {
			if (name_ == "START" || name_ == "MARKET") continue;
			World* world_ = &worlds.at(p - worlds.begin());
			if (find(world_->active_jammers.begin(), world_->active_jammers.end(), 226) == world_->active_jammers.end()) {
				int w_c = 0, s_c = 0, net_ = 0, a = 0;
				get_players(active_worlds.at(i_), w_c, s_c, net_, a);
				if (w_c > 0) {
					double size = 0.50;
					size -= 0.03 * w_c;
					if (size < 0.35) size = 0.35;
					c_active_worlds += "\nadd_floater|" + active_worlds.at(i_) + "|" + to_string(w_c) + "|" + to_string(size) + "|" + colorshit(w_c) + "";
				}
			}
		}
	}

	gamepacket_t p;
	p.Insert("OnRequestWorldSelectMenu");
	p.Insert("" + c_active_worlds + recently_visited + "\n");
	p.CreatePacket(peer);
	gamepacket_t p5;
	p5.Insert("OnConsoleMessage"), p5.Insert("Where would you like to go? (`w" + setGems(s_c3) + "`` online)"), p5.CreatePacket(peer);
}
Leave a Comment