Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server
You last visited: Today at 20:40

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help] create new packet

Discussion on [Help] create new packet within the Flyff Private Server forum part of the Flyff category.

Reply
 
Old   #1
 
420twisted1's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 181
Received Thanks: 23
[Help] create new packet

I need a detailed explanation on creating new packets I need to create one for CDPSrvr::LoadIPCut so that I can call it from dpsrvr.cpp( worldserver ) to use in a command this would help me learn and would be much appreciated.

I attempted and failed
I put

Code:
#define PACKETTYPE_RELOAD_BANS (DWORD)0x88100250
in MsgHdr.h
I also put

Code:
ON_MSG( PACKETTYPE_RELOAD_BANS, LoadIPCut );
Code:
void CDPSrvr::LoadIPCut()
{
}

in DpSrvr.cpp(world)

and
Code:
void    LoadIPCut();
in DpSrvr.h

and
Code:
ON_MSG( PACKETTYPE_RELOAD_BANS, LoadIPCut );
in DpSrvr.cpp(Account)

but received this error

Code:
error C2440: '=' : cannot convert from 'BOOL (__thiscall CDPSrvr::* )(void)' to 'void (__thiscall CDPSrvr::* )(CAr &,DPID,DPID,LPBYTE,u_long)'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
420twisted1 is offline  
Old 04/03/2012, 20:25   #2
 
aldimaster's Avatar
 
elite*gold: 122
Join Date: Mar 2008
Posts: 796
Received Thanks: 475
You have to add the specific parameters to your function:
PHP Code:
void    LoadIPCut(CAr arDPID dpidCacheDPID dpidUserLPBYTE lpBufu_long uBufSize);

void CDPSrvr::LoadIPCut(CAr arDPID dpidCacheDPID dpidUserLPBYTE lpBufu_long uBufSize)
{

It depends on how you send your packet to the server, but this should work.

Greetz
aldimaster is offline  
Old 04/03/2012, 20:52   #3
 
420twisted1's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 181
Received Thanks: 23
Quote:
Originally Posted by aldimaster View Post
You have to add the specific parameters to your function:
PHP Code:
void    LoadIPCut(CAr arDPID dpidCacheDPID dpidUserLPBYTE lpBufu_long uBufSize);

void CDPSrvr::LoadIPCut(CAr arDPID dpidCacheDPID dpidUserLPBYTE lpBufu_long uBufSize)
{

It depends on how you send your packet to the server, but this should work.

Greetz
FuncTextCmd.cpp(388) : error C2660: 'CDPSrvr::LoadIPCut' : function does not take 0 arguments

Code:
BOOL TextCmd_PERM_BAN( CScanner & scanner )
{
#ifdef __WORLDSERVER
	CUser* pUser = (CUser*)scanner.dwValue;
	
	scanner.GetToken();
	u_long idTarget	= CPlayerDataCenter::GetInstance()->GetPlayerId( scanner.token );
	CUser* pTarget	= g_UserMng.GetUserByPlayerID( idTarget );	

	if( !IsValidObj( pTarget ) )
	{
		pUser->AddText( "Invalid target name." );		
		return TRUE;
	}
	
	CString strPath;
	CString TNickName;
	CString UNickName;
	CString strTargetIp;
	char szBannish[MAX_PATH];
	UNickName = pUser->GetName();
	TNickName = pTarget->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 );
		g_DPCoreClient.SendKillPlayer( pTarget->m_idPlayer, idTarget );
                g_DPSrvr.LoadIPCut();// <----FuncTextCmd.cpp(388)
		pUser->AddText("User has been Banned");
	}
#endif // __WORLDSERVER
	return TRUE;
}
I need this command to call

Code:
BOOL CDPSrvr::LoadIPCut( LPCSTR lpszFileName )
{
	CMclAutoLock	Lock( m_csIPCut );

	InitIPCut();

	char strABClass[MAX_PATH];

	CScanner s;
	if( s.Load( lpszFileName ) )
	{
		s.GetToken();
		while( s.tok != FINISHED )
		{
			ZeroMemory( strABClass, sizeof( strABClass ) );
			
			GetABCClasstoString( s.Token, strABClass, m_nIPCut[m_nSizeofIPCut][0] );
			s.GetToken();
			s.GetToken();
			GetABCClasstoString( s.Token, strABClass, m_nIPCut[m_nSizeofIPCut][1] );

			int nFindLast = -1;
			STRING2INT::iterator iFind = m_sIPCut.find( strABClass );
			if( iFind != m_sIPCut.end() )
			{	
				int nFind = iFind->second;
				int nBufFind = m_nIPCut[nFind][2];
				nFindLast = nFind;
				while( nBufFind != -1 )
				{
					nFindLast = nBufFind;
					nBufFind = m_nIPCut[nBufFind][2];
				}
			}
			m_sIPCut.insert( map<string, int>::value_type( strABClass, m_nSizeofIPCut ) );
			++m_nSizeofIPCut;

			if( nFindLast != -1 )
			{
				m_nIPCut[nFindLast][2] = m_nSizeofIPCut - 1;
			}
			s.GetToken();
		}
		return TRUE;
	}
	
	return FALSE;
}
in Dpsrvr.cpp(account server)

so that when a user is banned the Ipcut.ini is reloaded preventing the user from logging in again

I also tried
Code:
g_DPSrvr.LoadIPCut( "Ipcut.ini" );
but got
FuncTextCmd.cpp(388) : error C2660: 'CDPSrvr::LoadIPCut' : function does not take 1 arguments
420twisted1 is offline  
Old 04/03/2012, 21:09   #4
 
aldimaster's Avatar
 
elite*gold: 122
Join Date: Mar 2008
Posts: 796
Received Thanks: 475
You are trying to call the function LoadIPCut in Neuz, but this is wrong.
You have to write a function which sends the packet PACKETTYPE_RELOAD_BANS to the server:

PHP Code:
dpclient.h
void    SendLoadIpCut
OBJID objid );

dpclient.cpp
void    CDPClient
::SendLoadIpCutOBJID objid );
{
    
BEFORESENDSOLEarPACKETTYPE_RELOAD_BANSDPID_UNKNOWN );
    
ar << g_pPlayer->m_idPlayer << objid;
    
SENDarthisDPID_SERVERPLAYER );

Now you can call SendLoadIpCut instead of LoadIpCut in FuncTextCmd.


Greetz
aldimaster is offline  
Old 04/03/2012, 21:28   #5
 
420twisted1's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 181
Received Thanks: 23
Quote:
Originally Posted by aldimaster View Post
You are trying to call the function LoadIPCut in Neuz, but this is wrong.
You have to write a function which sends the packet PACKETTYPE_RELOAD_BANS to the server:

PHP Code:
dpclient.h
void    SendLoadIpCut
OBJID objid );

dpclient.cpp
void    CDPClient
::SendLoadIpCutOBJID objid );
{
    
BEFORESENDSOLEarPACKETTYPE_RELOAD_BANSDPID_UNKNOWN );
    
ar << g_pPlayer->m_idPlayer << objid;
    
SENDarthisDPID_SERVERPLAYER );

Now you can call SendLoadIpCut instead of LoadIpCut in FuncTextCmd.


Greetz
so i dont need?
Code:
void CDPSrvr::LoadIPCut(CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)
{
}
Code:
\SRC\Program\_Interface\FuncTextCmd.cpp(388) : error C2065: 'g_DPlay' : undeclared identifier
\SRC\Program\_Interface\FuncTextCmd.cpp(388) : error C2228: left of '.SendLoadIpCut' must have class/struct/union type
420twisted1 is offline  
Old 04/04/2012, 12:51   #6
 
Unleashed!'s Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 395
Received Thanks: 233
You need the function in DPSrvr.cpp wich you want to call, also you need the ON_MSG(...) in the top of DPSrvr.cpp, wich tells the server, what function has to be called with wich packet. Then you need a function in DPClient.cpp to send the packet. I learned how to send packets, when i looked at another sourcerelease, where packets are used, i think this could help you :P
Unleashed! is offline  
Thanks
1 User
Old 04/04/2012, 14:09   #7

 
Flyff_Service's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 680
Received Thanks: 337
Meine Fresse, er will durch ein GM Befehl die IPCut im AccountServer neuladen lassen.

@420twisted1:
You are trying to call a function from WorldServer which is only implemented in AccountServer.
Choose one of these, to solve your problem
  1. Because only DatabaseServer is connected to AccountServer, you must send the packet from Worldserver => DatabaseServer => AccountServer.
  2. You must reactivate the connection between WorldServer and AccountServer, which is already implemented, so it shouldnt be too difficult.
Flyff_Service is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Howto] Create packet checksums
09/22/2009 - 9Dragons - 7 Replies
For many of you packet hackers around here I noticed many are slightly modifying captured packets and resending them. Which usually results in getting disconnected. The majority of the time it's due to not including the new checksum of the packet, the other time it's because the packet wasn't encrypted. To create a packet checksum, you must first be familiar with the structure of a basic 9Dragons packet. A sample packet looks like the following: 0C 00 62 02 1D 73 04 0A 01 00 F5 D3 The...



All times are GMT +1. The time now is 20:40.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.