void SendHakList(CNWSMessage *pMessage, int nPlayerID) { unsigned char *pData; long unsigned int nSize; CNWSModule *pModule = (CNWSModule *) (*NWN_AppManager)->app_server->srv_internal->GetModule(); if(pModule) { Connect.Log(0, "Sending hak list...\n"); CNWMessage *message = (CNWMessage*)pMessage; message->CreateWriteMessage(80, -1, 1); message->WriteINT(pModule->HakList.alloc, 32); for(int i = pModule->HakList.alloc - 1; i >= 0; --i) { message->WriteCExoString(pModule->HakList.data[i], 32);//TODO Connect.Log(0, "%s\n", pModule->HakList.data[i].text);//TODO } message->WriteCExoString(pModule->m_sCustomTLK, 32); Connect.Log(0, "%s\n", pModule->m_sCustomTLK.text); message->GetWriteMessage((char **) &pData, (uint32_t *) &nSize); pMessage->SendServerToPlayerMessage(nPlayerID, 100, 1, pData, nSize); } }
int CNWNXConnect::SendhakList( CNWSPlayer * ply ){ if( !ply ) return 0; CNWSMessage * msg = (*NWN_AppManager)->app_server->GetNWSMessage(); CNWNXMemory mem; CNWMessage * mess = NWNX_CreateMessage( ); if( !mess ){ return 0; } mess->WriteINT( HAKLen, 32 ); for( int n=0;n<HAKLen;n++ ){ mess->WriteCExoString( HAK[n], 32 ); } mess->WriteCExoString( *TLK, 32 ); char * data=0; DWORD len=0; if( mess->GetWriteMessage( &data, &len ) ){ msg->SendServerToPlayerMessage( ply->pl_id, 100, 0, data, len ); NWNX_DestroyMessage( mess ); return 1; } else NWNX_DestroyMessage( mess ); return 0; }