[Release] IP Ban command by Twisted

03/28/2012 00:47 420twisted1#1
I never tested this but it should work in theory
"/ban username"

Code:
BOOL TextCmd_BANNISH( CScanner & scanner )
{
#ifdef __WORLDSERVER
	CUser* pUser = (CUser*)scanner.dwValue;
	
	if( !IsValidObj( pUser ) )
	{
		pUser->AddText( "Invalid user." );		
		return TRUE;
	}

	scanner.GetToken();
	u_long idTarget	= CPlayerDataCenter::GetInstance()->GetPlayerId( scanner.token );

	if( idTarget == 0 )
		idTarget = pUser->m_idPlayer;

	CUser* pTarget	= g_UserMng.GetUserByPlayerID( idTarget );	

	if( !IsValidObj( pTarget ) )
	{
		pUser->AddText( "Invalid target name." );		
		return TRUE;
	}
	
	CString TNickName;
	CString UNickName;
	char szBannish[MAX_PATH];
	CString strTargetIp;
	CString strPath;
	TNickName = pTarget->GetName();
	UNickName = pUser->GetName();
	CString strIp = pTarget->m_playAccount.lpAddr;
	CString strAccnt = pTarget->m_playAccount.lpszAccount;
	
	if( pUser->IsAuthHigher( AUTH_GAMEMASTER ) ) 
	{
	    sprintf( szBannish, "%s , you have been Banned by [Staff member]--> %s", TNickName, UNickName );
	    pTarget->AddText( szBannish );
		strTargetIp.Format( "%s - %s // Accnt %s  UserNname %s was banned by Staff member %s ", strIp,  strIp, strAccnt, TNickName, UNickName );
		strPath.Format( "..\\Program\\IPCut.ini" );
		DSystemLog( strTargetIp, strPath, 0 );
		pUser->AddText("User has been Banned");
	}
#endif // __WORLDSERVER
	return TRUE;
}
Code:
ON_TEXTCMDFUNC( TextCmd_BANNISH,               "ban",                "BU",             "BAN",           "BU",       TCM_SERVER, AUTH_GAMEMASTER2   , "·¹º§ ¼³Á¤ Çϱâ" )
NOTE: I MADE THIS FOR LTD SOURCE aka DITS rev 4 and up
NOTE 2: to add this to an other source you must add DSystemLog which is easy if you have read through multiple sources


EDIT: I will improve code within the next day or so

let me know how it works
03/28/2012 01:35 ~Shirayuki~#2
Sowas gibt es schon oft auf epvp

#Closerquest
03/28/2012 01:36 Sedrika#3
Quote:
Originally Posted by ~Shirayuki~ View Post
Sowas gibt es schon oft auf epvp

#Closerquest
Zeig mir bitte einen Ban Command.
03/28/2012 01:40 ~Shirayuki~#4
Gib mir 30min ;D


1. Über Homepage :P (Fast jeder hat das ACP von SP)
2. 90% haben ein Antihack und somit können sie
%ban_account [Name]
%ban [Name]


dürfte reichen ;)
03/28/2012 01:50 Sedrika#5
Sind aber alles getrennte sachen.
Es ist klar, das ACP's einen Ban befehl haben.
Ebenso Antihacks, jedoch als anderweitigen Befehl hab ich es noch nicht gesehen, daher kann man es offen lassen.
03/28/2012 01:52 ~Shirayuki~#6
Aber großartig bringt es nix es einzubauen :P
Ist nicht schlecht sowas aber würdest du es einbauen? ^^

Ist nur ne persöhnliche frage die keine hintergründe hat.
03/28/2012 01:54 Sedrika#7
Da ich auf einen Antihack verzichte, wenn ich nen server mach', dann würd ich sowas einbauen, allerdings auch nur wenn mein ACP nicht Instand Ban hätte ;) (Kick + Ban)

Mir fällt bei dem Snippet grad aber auf, dass die IPCut.ini nicht neugeladen wird, somit der Ban erst nach dem restart des Account Servers gültig ist.
03/28/2012 01:57 ~Shirayuki~#8
Da ich die sprache nicht beherrsche kannst du villeicht es verbessern? :P
03/28/2012 02:27 420twisted1#9
I am the only person to have released a ingame GM ban command, I will edit to use a lua so it can reload after each ban
03/28/2012 02:32 Sedrika#10
Quote:
Originally Posted by 420twisted1 View Post
I am the only person to have released a ingame GM ban command, I will edit to use a lua so it can reload after each ban
That would be nice. Actually we're using other methods to ban a user.
03/28/2012 03:17 420twisted1#11
Quote:
Originally Posted by Sedrika View Post
That would be nice. Actually we're using other methods to ban a user.
how do you mean like trying to remember the users name then going to a cp on a site logging in then trying to send a ban through sql?

cuz this way would be faster, even faster then being on host and using a server manager exe

edit: i guess you could just make a table and check if name is in table send ACCOUNT_IPCUT_ADDR
03/28/2012 03:20 Sedrika#12
Quote:
Originally Posted by 420twisted1 View Post
how do you mean like trying to remember the users name then going to a cp on a site logging in then trying to send a ban through sql?

cuz this way would be faster, even faster then being on host and using a server manager exe
I got an Admin CP wich works with the server. If i kick a user via ACP he'll be kicked ingame and banned instandly.
03/28/2012 03:35 420twisted1#13
Quote:
Originally Posted by Sedrika View Post
I got an Admin CP wich works with the server. If i kick a user via ACP he'll be kicked ingame and banned instandly.
does it use a separate program or can you load it inside of neuz? i once made a cp and set it inside neuz so that you just have to click its icon but then you still have to secure the web page having a function do it seemed safer
03/28/2012 13:10 Lumi#14
Can you add a Unbann Command too ? o.o
03/28/2012 20:32 alfredico#15
You can use sockets + packets and send from website.