Hey guys i really need help to find the problem
problem- when player use OffTrade command can get to him (Ia Julia) "Your Account Already in game"
here the source please help , i think that is something in OffTradeProtocol
if to someone have another Offtrade system share with me i will be really happy ; Here the sources :
OffTrade.h
Código PHP:
#include "stdafx.h"
#ifdef _GS
#include "prodef.h"
#include "Utilits.h"
#include "WinSock2.h"
#include "ws2def.h"

class OffTrade
{
public:
    
OffTrade(void);
    ~
OffTrade(void);
    
void CreateOfflineStore(int aIndex);
    
void InitOfflineTrade();

    
struct sConfigs
    
{
        
int Enabled;
        
int LevelReq;  
        
DWORD PriceZen;  
    }
Configs;
};
extern OffTrade OfflineTrade;

#define HIDE_ERRORL10
#define MAX_EXSENDBUF_SIZE 7024
#define MAX_IO_BUFFER_SIZE        6000
#define MAX_IO_THREAD_HANDLES    16

struct _PER_IO_CONTEXT_2

    
WSAOVERLAPPED Overlapped
    
WSABUF wsabuf
    
unsigned char Buffer[MAX_IO_BUFFER_SIZE]; 
    
unsigned char BufferSecond[MAX_IO_BUFFER_SIZE]; 
    
int nSecondOfs
    
int nTotalBytes;
    
int nSentBytes
    
int IOOperation
    
int nWaitIO
}; 

struct _PER_SOCKET_CONTEXT_2
{
    
SOCKET m_socket;    
    
int nIndex;    
    
_PER_IO_CONTEXT_2 IOContext[2];    
    
int dwIOCount;    
}; 

struct PSBMSG_HEAD_TT
{
    
BYTE type;
    
BYTE size;
    
BYTE head;
    
BYTE subh;
};

struct PMSG_ANS_PERIODITEM_INSERT
{
    
PBMSG_HEAD2 head;
    
int iUserIndex;
    
int iItemCode;
    
int iItemPeriodDate;
    
BYTE btItemEffectType1;
    
BYTE btItemEffectType2;
    
BYTE btResult;
};

struct PMSG_IDPASS {
    
struct PSBMSG_HEAD_TT h;
    
unsigned char subcode;
    
char Id[10];
    
char Pass[10];
    
unsigned long TickCount;
    
unsigned char CliVersion[5];
    
unsigned char CliSerial[16];
};

#define CGPShopAnsClose_Hook 0x004041C4
#define CGPShopAnsClose ((void(*)(int,BYTE))0x0044B2C0)
#define ResponErrorCloseClient ((void(*)(int))0x004B4130)
#define ResponErrorCloseClient_Hook 0x00403E95
#define CloseClient2_Ex ((void(*)(_PER_SOCKET_CONTEXT*,int))0x004B3F70)
#define CloseClient2_Hook 0x004057D6
#define CSPJoinIdPassRequest_Hook 0x0040291E
#define CSPJoinIdPassRequest ((void(*)(PMSG_IDPASS *lpMsg, int aIndex)) 0x0043A670)
#define gObjDelHook 0x00403AE4
#define gObjCloseSetHook 0x00401B5E

void CGPShopAnsClose_Ex(int aIndexBYTE btResult);
void CloseClient2Ex(_PER_SOCKET_CONTEXT_2 lpPerSocketContextint result);
void __cdecl CSPJoinIdPassRequestEx(PMSG_IDPASS *lpMsgint aIndex);
int CheckItems(DWORD PlayerID,DWORD itemId,int ItemLevel,int ItemOpt,int ItemLuck,int ItemSkill);
int  retResistance(LPOBJ lpObjint Resistance_Type);
short gObjDel_Ex(int aIndex);
void ResponErrorCloseClientEx(int Index);


#endif 
OffTrade.Cpp
Código PHP:
#include "stdafx.h"
#include "OffTrade.h"
#include "User.h"
#include "Prodef.h"
#include "WinError.h"
#include "WinSock2.h"
#include "WinBase.h"
#include "Utilits.h"
#include "ChatCommands.h"
#ifdef _GS
//------------------------------------------------------------------------------------------------------
CRITICAL_SECTION criti;
OffTrade OfflineTrade
//------------------------------------------------------------------------------------------------------
OffTrade::OffTrade(void)
{
    
//-- CONSTRUCTOR --
}

//------------------------------------------------------------------------------------------------------
void OffTrade::InitOfflineTrade()
{
    
Utilits.HookThis((DWORD)&CGPShopAnsClose_Ex,CGPShopAnsClose_Hook);
    
Utilits.HookThis((DWORD)&CloseClient2Ex,CloseClient2_Hook);
    
Utilits.HookThis((DWORD)&CloseClient2Ex,CloseClient2_Hook);
    
Utilits.HookThis((DWORD)&ResponErrorCloseClientEx,ResponErrorCloseClient_Hook);
    
}
//------------------------------------------------------------------------------------------------------
OffTrade::~OffTrade(void)
{
    
//-- DESTRUCTOR ----
}

void ResponErrorCloseClientEx(int Index)
{
    if ( 
Index || Index 8999 )
    { 
        return;
    }

    
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);
    if ( 
gObj->Connected == PLAYER_EMPTY )
    { 
        return;
    }

    if(
AddTab[Index].OfflineTrade == true)
        return;

    
ResponErrorCloseClient(Index);
}

//------------------------------------------------------------------------------------------------------
void OffTrade::CreateOfflineStore(int aIndex)
{
    
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
    
AddTab[aIndex].OfflineTrade=true;
     
    
CloseClient(aIndex);
}
//------------------------------------------------------------------------------------------------------
void CGPShopAnsClose_Ex(int aIndexBYTE btResult)
{
    
// Function calling when Personal store is closing. 
    // Also it is calling when Personal store become empty.
    
CGPShopAnsClose(aIndex,btResult);
    
    if(
AddTab[aIndex].OfflineTrade == true)
    {
        
AddTab[aIndex].OfflineTrade false;
        
gObjDel_Ex(aIndex);
        
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); 
    }
}
//------------------------------------------------------------------------------------------------------
void CloseClient2Ex(_PER_SOCKET_CONTEXT_2 lpPerSocketContextint result)
{
    
// Very easy function hooking. Just disable auto log-off of Disconnected Characters ;)
    
int index = -1;
    
index lpPerSocketContext->nIndex ;    
    
//---
    
if ( index >= 8000 && index 9000 )
    {        
        
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(index); 
        if ( 
gObj->m_socket  != INVALID_SOCKET )
        {
            if ( 
closesocket(gObj->m_socket) == -)
                if ( 
WSAGetLastError() != WSAENOTSOCK )
                    return;
            
gObj->m_socket INVALID_SOCKET
        }
        
gObjDel_Ex(index); 
    }
}
//------------------------------------------------------------------------------------------------------
short gObjDel_Ex(int aIndex)
{
    
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
     
    if(
AddTab[aIndex].OfflineTrade == true)
        return 
1;
     
    if(
aIndex 8000 || AddTab[aIndex].CloseSetCheck == true)
        return 
gObjDel(aIndex); 

    return 
gObjDel(aIndex);
}
//------------------------------------------------------------------------------------------------------
#endif 
OffTradeProtocol.h
Código PHP:
#ifdef _GS
#pragma once
class cOffProtocol
{
public:
    
cOffProtocol(void);
    
virtual ~cOffProtocol(void);
    
void SendGetRequest(char *message, ...);
    
void Init(void);
    
void ICSPJoinIdPassRequest(LPBYTE aRecv,int aIndex);
    static 
void Login_Timer(void lpParam);
};
extern cOffProtocol OffProtocol;
#endif 
OffTradeProtocol.cpp
Código PHP:
#include "stdafx.h"
#include "OffTradeProtocol.h"
#include "User.h"
#include "Prodef.h"
#include "Utilits.h"
#include "tchar.h"
#include "Prodef.h"
#include "OffTrade.h"

#ifdef _GS
cOffProtocol OffProtocol

//----------------------------------------------------------------------------------------------------------------------------------
cOffProtocol::cOffProtocol(void)
{
    
//----------------------------------------
}
//----------------------------------------------------------------------------------------------------------------------------------
cOffProtocol::~cOffProtocol(void)
{
    
//----------------------------------------
}
//----------------------------------------------------------------------------------------------------------------------------------
void cOffProtocol::Init(void)
{
    
//-----------------------------------------

//----------------------------------------------------------------------------------------------------------------------------------
void cOffProtocol::ICSPJoinIdPassRequest(LPBYTE aRecv,int aIndex)
{
    
char id[11];
    
int isOff 0;
 
    
PMSG_IDPASS *lpMsg = (PMSG_IDPASS *)aRecv;
    
OBJECTSTRUCT *gObjt = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
    
    
id[10]=0;
    
memcpy(idlpMsg->Idsizeof(lpMsg->Id));
    
BuxConvert(idMAX_ACCOUNT_LEN);

     for(
int i=8000;i<9000;i++)
    {   

        
OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);
        if(
gObj->Connected == && AddTab[i].OfflineTrade == true)
        {
            
//gObj_GetLogin(aIndex,Login);
            
if(!strcmp(gObj->AccountIDgObjt->AccountID))
            {
                
AddTab[i].OfflineTrade false;
                
CloseClient(i);
                
gObjDel(i);
                
isOff 1;
                
//this not tested
                
AddTab[aIndex].aRecv aRecv;
                
AddTab[aIndex].OfflineTrade false;
                break;
            }
        }
    } 
    if(
isOff)
        
_beginthreadcOffProtocol::Login_Timer0, (void*)aIndex  );
    else
        
CSPJoinIdPassRequest(lpMsg,aIndex);
}
//----------------------------------------------------------------------------------------------------------------------------------
void cOffProtocol::Login_Timer(void lpParam)
{
    
int aIndex = (int)lpParam;
    
Sleep(3000);
    
PMSG_IDPASS *lpMsg = (PMSG_IDPASS *)AddTab[aIndex].aRecv;
    
CSPJoinIdPassRequest(lpMsg,aIndex);
    
_endthread();

}
#endif 
really thanks for helpers...