• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Ctrl + y

Hjuston

New Member
Joined
Sep 29, 2009
Messages
11
Reaction score
0
Hi guys, I know that I can use ctrl + y to ban people.
But how to define the time of banishment?
For example when I change in config.lua ban time to 60*60*60 I mean 1 hour.
Then I want to ban a player with nick xxx for bot for x hours.
I don't understand it.
And what is statement? Why I can't enter there anything?
Thanks for help.
 
  1. You can't specify a custom time with CTRL+Y
  2. 1 hour is 60*60*1000
  3. Statement is used when you're banning a player for something (a message) that he/she said.
 
  1. You can't specify a custom time with CTRL+Y
  2. 1 hour is 60*60*1000
  3. Statement is used when you're banning a player for something (a message) that he/she said.

Well, you have fail menz.

Code:
	std::string::size_type start = comment.find("{"), end = std::string::npos;
	if(start != std::string::npos)
		end = comment.find("}", start + 1);

	time_t length[3] = {0, 0, 0};
	if(end != std::string::npos)
	{
		int32_t i = 0;
		StringVec vec = explodeString(comment.substr(start + 1, end - start - 1), ",");
		for(StringVec::iterator it = vec.begin(); it != vec.end() && i < 4; ++it, ++i)
		{
			if((*it) == "delete")
			{
				i--;
				action = ACTION_DELETION;
				continue;
			}

			time_t banTime = time(NULL);
			StringVec tec = explodeString((*it), "+");
			for(StringVec::iterator tit = tec.begin(); tit != tec.end(); ++tit)
			{
				std::string tmp = (*tit);
				uint32_t count = 1;
				if(tmp.size() > 1)
				{
					std::string str;
					uint32_t textLength = tmp.length();
					for(uint32_t size = 0; size < textLength; ++size)
					{
						if(isNumber(tmp.at(size)))
							str += tmp.at(size);
					}

					count = atoi(str.c_str());
					if(!count)
						count = 1;
					else
						tmp = tmp.substr(str.length(), 1);
				}

				toLowerCaseString(tmp);
				if(tmp[0] != 's' && tmp[0] != 'm' && tmp[0] != 'h' && tmp[0] != 'd'
					&& tmp[0] != 'w' && tmp[0] != 'o' && tmp[0] != 'y')
					continue;

				if(tmp[0] == 's')
					banTime += count;

				if(tmp[0] == 'm')
					banTime += count * 60;

				if(tmp[0] == 'h')
					banTime += count * 3600;

				if(tmp[0] == 'd')
					banTime += count * 86400;

				if(tmp[0] == 'w')
					banTime += count * 604800;

				if(tmp[0] == 'o')
					banTime += count * 2592000;

				if(tmp[0] == 'y')
					banTime += count * 31536000;

				length[i] = banTime;
			}
		}

		comment = comment.substr(0, start);
	}
 
weak weak ;
ZqxHV.png
ZqxHV.png
/
 
Thanks for spam, let's back to a thread now...
So when I'm trying to ban somebody I will always ban him for time defined in config.lua?
 
{h=5} doesn't work - adds one hour to ban lenght because of count is 1 in code
{h+5} doesn't work too - same, adds one hour
I think I'm doing something wrong with count, hmm... I know it, but what is that?
How to set a count my specified number?
 
Back
Top