示例#1
0
bool HandleBanAccountCommand(BaseConsole* pConsole, int argc, const char* argv[])
{
	if(argc < 3)
		return false;

	int32 timeperiod = GetTimePeriodFromString(argv[2]);
	if(timeperiod < 0)
		return false;

	uint32 banned = (timeperiod ? (uint32)UNIXTIME + timeperiod : 1);

	char emptystring = 0;
	char* pReason;
	if(argc == 4)
		pReason = (char*)argv[3];
	else
		pReason = &emptystring;

	/// apply instantly in db
	sLogonCommHandler.Account_SetBanned(argv[1], banned, pReason);

	pConsole->Write("Account '%s' has been banned %s%s. The change will be effective immediately.\r\n", argv[1],
	                timeperiod ? "until " : "forever", timeperiod ? ConvertTimeStampToDataTime(timeperiod + (uint32)UNIXTIME).c_str() : "");

	return true;
}
示例#2
0
bool HandleBanAccountCommand(BaseConsole * pConsole, int argc, const char * argv[])
{
    if(argc < 4)
        return false;

    int32 timeperiod = GetTimePeriodFromString(argv[2]);
    if(timeperiod < 0)
        return false;

    uint32 banned = (timeperiod ? (uint32)UNIXTIME+timeperiod : 1);

    /// apply instantly in db
    sLogonCommHandler.Account_SetBanned(argv[1], banned, argv[3]);

    pConsole->Write("Account '%s' has been banned %s%s. The change will be effective with the next reload cycle.\r\n", argv[1],
                    timeperiod ? "until " : "forever", timeperiod ? ConvertTimeStampToDataTime(timeperiod+(uint32)UNIXTIME).c_str() : "");

    return true;
}
示例#3
0
bool HandleBanAccountCommand(BaseConsole * pConsole, int argc, const char * argv[])
{
	if(argc < 3)
		return false;

	int32 timeperiod = GetTimePeriodFromString(argv[2]);
	if(timeperiod < 0)
		return false;

	uint32 banned = (timeperiod ? (uint32)UNIXTIME+timeperiod : 1);

	sLogonCommHandler.LogonDatabaseSQLExecute("UPDATE accounts SET banned = %u WHERE login = '******'", banned, CharacterDatabase.EscapeString(string(argv[1])).c_str());
	sLogonCommHandler.LogonDatabaseReloadAccounts();

	pConsole->Write("Account '%s' has been banned %s%s. The change will be effective with the next reload cycle.\r\n", argv[1], 
		timeperiod ? "until " : "forever", timeperiod ? ConvertTimeStampToDataTime(timeperiod+(uint32)UNIXTIME).c_str() : "");
	
	return true;
}