void SellItem(int nBagNum, int nBagSlot, int nAmount)
{
BYTE* tmp = new BYTE[5];
*reinterpret_cast<WORD*>(tmp) = 0x0703;
*static_cast<BYTE*>(tmp + 2) = nBagNum;
*static_cast<BYTE*>(tmp + 3) = nBagSlot;
*static_cast<BYTE*>(tmp + 4) = nAmount;
SendPacket(tmp, 5);
delete[] tmp;
}


void SellItem(int nBagNum, int nBagSlot, int nAmount)
{
BYTE* tmp = new BYTE[5];
*reinterpret_cast<WORD*>(tmp) = 0x0703;
*static_cast<BYTE*>(tmp + 2) = nBagNum;
*static_cast<BYTE*>(tmp + 3) = nBagSlot;
*static_cast<BYTE*>(tmp + 4) = nAmount;
SendPacket(tmp, 5);
delete[] tmp;
}
void PacketLoop( char cNItems ){
int nBag = 0, nSlot = 0;
for( nBag = 0; nBag != 0xFF; nBag++ ) { // loop through all the bags
for( nSlot = 0; nSlot != 0xFF; nSlot++) { // loop through all slots for each bag
SellItem( nBag, nSlot, (int)cNItems ); // sell this slot
}
}
return;
}
#include <winsock2.h>
#pragma comment( lib, "wsock32.lib" )
void StartSocket()
{
return WSAStartup( MAKEWORD(2,2), &WsaData ) == NO_ERROR;
}
void CloseSocket()
{
WSACleanup();
}
int main32_t ()
{
StartSocket();
DWORD NoBlock = 1;
int IntWinSock = NULL;
IntWinSock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
if ( IntWinSock <= 0 )
{
MessageBox(0,"Error to create socket",0,MB_ICONERROR);
return false;
}
unsigned int a = xxx; // Your IP
unsigned int b = xxx;
unsigned int c = xxx;
unsigned int d = xxx;
WORD port = xxx; //YOUR PORT
unsigned int AddressDestination = ( a << 24 ) | ( b << 16 ) | ( c << 8 ) | d;
unsigned short PortDestination = Port;
sockaddr_in Address;
address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl( AddressDestination );
address.sin_port = htons( PortDestination );
if ( bind( handle, (const sockaddr*) &Address, sizeof(sockaddr_in) ) < 0 )
{
MessageBox(0,"Error to bind socket",0,MB_ICONERROR);
return false;
}
if ( ioctlsocket( IntWinSock, FIONBIO, &NoBlock ) != 0 )
{
MessageBox(0,"Error to noBlocking socket",0,MB_ICONERROR);
return false;
}
char PacketData[256];
char PacketSize[256];
do{
int SendPacket = sendto( IntWinSock, (const char*)PacketData, PacketSize,
0, (sockaddr*)&Address, sizeof(sockaddr_in) );
if ( SendPacket != PacketSize )
{
char BufferOverround[256];
sprintf(BufferOverround, "Error to send packet, Error value: %d", SendPacket);
MessageBox(0,BufferOverround,0,MB_ICONERROR);
return false;
}
}while(GetAsyncKeyState(VK_CTRL));
CloseSocket();
}