Ejemplo n.º 1
0
void CHudStyleBar::MsgFunc_StyleAnnouncement( bf_read &msg )
{
	announcement_t eAnnouncement = (announcement_t)msg.ReadLong();
	style_point_t ePointStyle = (style_point_t)msg.ReadByte();
	float flBar = msg.ReadFloat();
	float flPoints = msg.ReadFloat();

	CAnnouncement oAnnouncement;
	oAnnouncement.m_flStartTime = gpGlobals->curtime;
	oAnnouncement.m_eAnnouncement = eAnnouncement;
	oAnnouncement.m_ePointStyle = ePointStyle;
	oAnnouncement.m_flBarPosition = flBar;

	if (m_aAnnouncements.Count())
	{
		// If a few at a time come in off the wire don't throw them all up at once. Subsequent ones should come in with a delay.

		float flDelay = 0.02f;
		if (gpGlobals->curtime < m_aAnnouncements[m_aAnnouncements.Tail()].m_flStartTime + flDelay)
			oAnnouncement.m_flStartTime = m_aAnnouncements[m_aAnnouncements.Tail()].m_flStartTime + flDelay;
	}

	oAnnouncement.m_flStylePoints = flPoints;

	m_aAnnouncements.AddToTail(oAnnouncement);
}
Ejemplo n.º 2
0
void __MsgFunc_HapPunch( bf_read &msg )
{
#ifdef WIN32
	float x = msg.ReadFloat();
	float y = msg.ReadFloat();
	float z = msg.ReadFloat();

	HapticsHandleMsg_HapPunch( QAngle(x,y,z) );
#endif // WIN32
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
// Output : static int
//-----------------------------------------------------------------------------
void __MsgFunc_Shake( bf_read &msg )
{
	ScreenShake_t shake;

	shake.command	= msg.ReadByte();
	shake.amplitude = msg.ReadFloat();
	shake.frequency = msg.ReadFloat();
	shake.duration	= msg.ReadFloat();

	g_ViewEffects.Shake( shake );
}
Ejemplo n.º 4
0
void __MsgFunc_HapDmg( bf_read &msg )
{
#ifdef WIN32
	float pitch = msg.ReadFloat();
	float yaw = msg.ReadFloat();
	float damage = msg.ReadFloat();
	int damageType = msg.ReadLong();

	HapticsHandleMsg_HapDmg( pitch, yaw, damage, damageType );
#endif // WIN32
}
Ejemplo n.º 5
0
void __MsgFunc_ASWSentryTracer( bf_read &msg )
{
	int iSentry = msg.ReadShort();		
	C_ASW_Sentry_Top *pSentry = dynamic_cast<C_ASW_Sentry_Top*>( ClientEntityList().GetEnt( iSentry ) );		// turn iMarine ent index into the marine

	Vector vecEnd;
	vecEnd.x = msg.ReadFloat();
	vecEnd.y = msg.ReadFloat();
	vecEnd.z = msg.ReadFloat();

	if ( pSentry )
	{
		pSentry->ASWSentryTracer( vecEnd );
	}
}
Ejemplo n.º 6
0
void __MsgFunc_HapSetDrag( bf_read &msg )
{
#ifdef WIN32
	float drag = msg.ReadFloat();
	HapticsHandleMsg_HapSetDrag( drag );
#endif // WIN32
}
Ejemplo n.º 7
0
void __MsgFunc_ASWNewHoldoutWave( bf_read &msg )
{
	int nWave = msg.ReadByte();
	float flDuration = msg.ReadFloat();

	CASW_Hud_Holdout *pHoldoutHud = GET_HUDELEMENT( CASW_Hud_Holdout );
	pHoldoutHud->AnnounceNewWave( nWave, flDuration );
}
Ejemplo n.º 8
0
void __MsgFunc_ASWShowHoldoutWaveEnd( bf_read &msg )
{
	int nWave = msg.ReadByte();
	float flDuration = msg.ReadFloat();

	CASW_Hud_Holdout *pHoldoutHud = GET_HUDELEMENT( CASW_Hud_Holdout );
	pHoldoutHud->ShowWaveScores( nWave, flDuration );
}
Ejemplo n.º 9
0
static void MsgFunc_ShowObjectives( bf_read &msg )
{
    CASWHudObjective *pObjectives = GET_HUDELEMENT( CASWHudObjective );
    if ( !pObjectives )
        return;

    pObjectives->ShowObjectives( msg.ReadFloat() );
}
Ejemplo n.º 10
0
void CHoloShipComm::MsgFunc_HoloMessage( bf_read &msg )
{
	char szDisplayName[ 128 ];
	char szWaveName[ 128 ];
	msg.ReadString( szDisplayName, sizeof( szDisplayName ) );
	msg.ReadString( szWaveName, sizeof( szWaveName ) );
	const float flDuration = msg.ReadFloat();

	//Msg( "Holo message received: %s, %s, %f\n", szDisplayName, szWaveName, flDuration );

	wchar_t wszFormatted[ 64 ];
	g_pVGuiLocalize->ConstructString( wszFormatted, sizeof( wszFormatted ),
		SafeLocalizeInline( "#holo_gui_comm_incoming" ).Get(),
		1, SafeLocalizeInline( szDisplayName ).Get() );
	m_pLabelHeader->SetText( wszFormatted );

	m_flResetTimer = flDuration;
	m_flFlashTimer = 0.5f;

	ResetWaveForm( szWaveName );
}
Ejemplo n.º 11
0
/*=======================================================
	Protocol:
		EventType	[long]
		teamid		[long]
		userid		[long]
=======================================================*/
void CHudFlagCarrier::MsgFunc_UpdateFlagCarrier( bf_read& data )
{
	int event = data.ReadLong();
	int teamid = data.ReadLong();
	int flagteamid = data.ReadLong();
	int userid = data.ReadLong();

	if ( event == HFLG_PICKUP )
	{
		int teamIndex = flagteamid;
		m_FlagState[ teamIndex ] = HFLG_PICKUP;
		UpdateFlagState( teamIndex );

		m_iTakenByPlayer[ teamIndex ] = userid;
		UpdateTakenAvatar( teamIndex );
	}
	else if ( event == HFLG_DROPPED || event == HFLG_DROPPED_TIMER )
	{
		m_DroppedMaxTime = data.ReadFloat();

		int teamIndex = flagteamid;
		m_FlagState[ teamIndex ] = HFLG_DROPPED_TIMER;
		m_DroppedTimer[ teamIndex ].Reset();
		m_DroppedTimer[ teamIndex ].Start( 0.0f );
		UpdateFlagState( teamIndex );

		m_iTakenByPlayer[ teamIndex ] = TAKEN_INVALID_PLAYER;
	}
	else if ( event == HFLG_RETURNED )
	{
		int teamIndex = flagteamid;
		m_FlagState[ teamIndex ] = HFLG_BASE;
		m_DroppedTimer[ teamIndex ].Reset();
		UpdateFlagState( teamIndex );

		m_iTakenByPlayer[ teamIndex ] = TAKEN_INVALID_PLAYER;
	}
}
//-----------------------------------------------------------------------------
// Purpose: Message handler for ASWOrderUseItemFX message
//-----------------------------------------------------------------------------
void CASW_Hud_Squad_Hotbar::MsgFunc_ASWOrderUseItemFX( bf_read &msg )
{
	int iMarine = msg.ReadShort();	
	C_ASW_Marine *pMarine = dynamic_cast<C_ASW_Marine*>(ClientEntityList().GetEnt(iMarine));		// turn iMarine ent index into the marine
	if ( !pMarine )
		return;

	int iOrderType = msg.ReadShort();
	int iInventorySlot = msg.ReadShort();

	Vector vecPosition;
	vecPosition.x = msg.ReadFloat();
	vecPosition.y = msg.ReadFloat();
	vecPosition.z = msg.ReadFloat();

	// loops through to see if we already have an order effect for this marine
	StopItemFX( pMarine );

	const char *pszClassName = NULL;

	switch( iOrderType )
	{
	case ASW_USE_ORDER_WITH_ITEM:
		{
			// check we have an item in that slot
			CASW_Weapon* pWeapon = pMarine->GetASWWeapon( iInventorySlot );
			if ( !pWeapon || !pWeapon->GetWeaponInfo() || !pWeapon->GetWeaponInfo()->m_bOffhandActivate )
				return;

			pszClassName = pWeapon->GetClassname();
		}
		break;

	case ASW_USE_ORDER_HACK:
		{
			pszClassName = "asw_weapon_t75";	// for now, we're using the t75 icon for hacking
		}
		break;

	default:
		{
			Assert( false ); // unspecified order type
			return;
		}
		break;
	}

	//CNewParticleEffect *pEffect = pMarine->ParticleProp()->Create( "order_use_item", PATTACH_CUSTOMORIGIN, -1, vecPosition - pMarine->GetAbsOrigin() );
	CNewParticleEffect *pEffect = pMarine->ParticleProp()->Create( "order_use_item", PATTACH_ABSORIGIN );
	if ( pEffect )
	{
		pMarine->ParticleProp()->AddControlPoint( pEffect, 1, pMarine, PATTACH_CUSTOMORIGIN );
		pEffect->SetControlPoint( 1, vecPosition );//vecPosition - pMarine->GetAbsOrigin()
		for ( int i = 0; i < NUM_USE_ITEM_ORDER_CLASSES; i++ )
		{
			if ( pszUseItemOrderClasses[i] && !Q_strcmp (  pszUseItemOrderClasses[i]  ,  pszClassName )  )
			{
				pEffect->SetControlPoint( 2, Vector( i, 0, 0 ) );
				break;
			}
		}

		HotbarOrderEffectsList_t::IndexLocalType_t iIndex = m_hHotbarOrderEffects.AddToTail();
		m_hHotbarOrderEffects[iIndex].iEffectID = iMarine;
		m_hHotbarOrderEffects[iIndex].pEffect = pEffect;
	}
}
Ejemplo n.º 13
0
bool HandleMessage(bf_read &msg, int type)
{

	if (type == 0) // nop
	{
		//	printf("NOP\n");
		return true;
	}

	if (type == 1) // disconnect
	{
		char dcreason[1024];
		msg.ReadString(dcreason, sizeof(dcreason));
		printf("Disconnected: %s\n", dcreason);
		printf("Reconnecting in 5000 ms ...");

		_sleep(5000);
		NET_Reconnect();
		return true;
	}

	if (type == 2)//net_File
	{
		long transferid = msg.ReadUBitLong(32);
		char filename[255];
		msg.ReadString(filename, sizeof(filename));
		bool requested = (bool)(msg.ReadOneBit()==1);

		if (requested)
			printf("net_File: Server requested file: %s::%i\n", filename, transferid);
		else
			printf("net_File: Server is not sending file: %s::%i\n", filename, transferid);

		return true;
	}
	if (type == 3)//net_Tick
	{
		net_tick = msg.ReadLong();
		net_hostframetime = msg.ReadUBitLong(16);
		net_hostframedeviation = msg.ReadUBitLong(16);
		//printf("Tick: %i - hostframetime: %i ( deviation: %i )\n", net_tick, net_hostframedeviation, net_hostframedeviation);

		return true;
	}

	if (type == 4)//net_StringCmd
	{
		char cmd[1024];
		msg.ReadString(cmd, sizeof(cmd));

		printf("net_StringCmd: %s\n", cmd);
		return true;
	}

	if (type == 5)//net_SetConVar
	{

		int count = msg.ReadByte();

		char cmdname[255];
		char cmdval[255];

		printf("net_SetConVar: %i\n", count);
		for (int i = 0; i < count; i++)
		{
			msg.ReadString(cmdname, sizeof(cmdname));
			msg.ReadString(cmdval, sizeof(cmdval));
			printf("%s to: %s\n", cmdname, cmdval);

		}
		printf("net_SetConVar_end, left: %i\n", msg.GetNumBytesLeft());
		return true;

	}

	if (type == 6)// net_SignonState
	{
		int state = msg.ReadByte();
		long aservercount = msg.ReadLong();


		printf("Received net_SignOnState: %i, count: %i\n", state, bconnectstep);

		if (netchan->m_iSignOnState == state)
		{
			printf("Ignored signonstate!\n");
			return true;
		}

		netchan->m_iServerCount = aservercount;
		netchan->m_iSignOnState = state;

		printf("KK __ %i\n", state);
		if (state == 3)
		{

			senddata.WriteUBitLong(8, 6);
			senddata.WriteLong(netchan->m_iServerCount);
			senddata.WriteLong(518790445);//clc_ClientInfo crc
			senddata.WriteOneBit(1);//ishltv
			senddata.WriteLong(1337);

			static int shit = 20;
			shit++;
			printf("LOL: %i\n", shit);

			senddata.WriteUBitLong(0, shit);

			NET_SendDatagram(0);

			senddata.WriteUBitLong(0, 6);

			senddata.WriteUBitLong(6, 6);
			senddata.WriteByte(state);
			senddata.WriteLong(aservercount);
			NET_SendDatagram(0);

			return true;
		}

		if (bconnectstep)
		{


			if (state == 4 && false)
			{
				senddata.WriteUBitLong(12, 6);

				for (int i = 0; i < 32; i++)
				{
					senddata.WriteUBitLong(1, 32);
				}

			}

			senddata.WriteUBitLong(6, 6);
			senddata.WriteByte(state);
			senddata.WriteLong(aservercount);



			NET_SendDatagram(false);

			return true;
		}

		senddata.WriteUBitLong(6, 6);
		senddata.WriteByte(state);
		senddata.WriteLong(aservercount);




		return true;
	}

	if (type == 7) // svc_Print
	{
		char print[2048];
		msg.ReadString(print, sizeof(print));
		//	printf("svc_Print: %s", print);
		printf("%s", print);
		return true;
	}

	if (type == 8)//svc_ServerInfo
	{
		unsigned short protoversion = msg.ReadShort();
		long servercount = msg.ReadLong();

		bool srctv = (bool)(msg.ReadOneBit() == 1);
		bool dedicated = (bool)(msg.ReadOneBit() == 1);
		long crc = msg.ReadLong();
		short maxclasses = msg.ReadWord();
		char mapmd5[16];
		msg.ReadBytes(mapmd5, 16);

		char players = msg.ReadByte();
		char maxplayers = msg.ReadByte();
		float tickinterval = msg.ReadFloat();
		char platform = msg.ReadChar();

		char gamedir[255];
		char levelname[255];
		char skyname[255];
		char hostname[255];
		char loadingurl[255];
		char gamemode[255];

		msg.ReadString(gamedir, sizeof(gamedir));
		msg.ReadString(levelname, sizeof(levelname));
		msg.ReadString(skyname, sizeof(skyname));
		msg.ReadString(hostname, sizeof(hostname));
		msg.ReadString(loadingurl, sizeof(loadingurl));
		msg.ReadString(gamemode, sizeof(gamemode));

		printf("ServerInfo, players: %lu/%lu | map: %s | name: %s | gm: %s | count: %i | left: %i | step: %i\n", players, maxplayers, levelname, hostname, gamemode, servercount, msg.GetNumBitsLeft(), bconnectstep);

		netchan->m_iServerCount = servercount;
		bconnectstep = 4;

		return true;
	}

	if (type == 10)//svc_ClassInfo
	{
		int classes = msg.ReadShort();
		int useclientclasses = msg.ReadOneBit();

		unsigned int size = (int)(log2(classes) + 1);


		if (useclientclasses == 0)
		{
			printf("Received svc_ClassInfo | classes: %i: \n", classes);
			for (int i = 0; i < classes; i++)
			{
				int classid = msg.ReadUBitLong(size);

				char classname[255];
				char dtname[255];

				msg.ReadString(classname, sizeof(classname));
				msg.ReadString(dtname, sizeof(dtname));

				printf("Classname: %s | DTname: %s | ClassID: %i\n", classname, dtname, classid);
			}
			printf("svc_ClassInfo end\n");
		}
		else {
			printf("Received svc_ClassInfo, classes: %i\n", classes);
		}

		return true;
	}

	if (type == 11)//svc_SetPause
	{
		int state = msg.ReadOneBit();
		printf("Received svc_SetPause, state: %i\n", state);

		return true;
	}

	if (type == 12)//svc_CreateStringTable
	{

		char name[500];
		msg.ReadString(name, sizeof(name));

		short maxentries = msg.ReadWord();

		unsigned int size = (int)(log2(maxentries) + 1);
		int entries = msg.ReadUBitLong(size);

		int bits = msg.ReadVarInt32();
		int userdata = msg.ReadOneBit();

		//if (m_bUserDataFixedSize)
		//{
		//	buffer.WriteUBitLong(m_nUserDataSize, 12);
		//	buffer.WriteUBitLong(m_nUserDataSizeBits, 4);
		//}

		if (userdata == 1)
		{
			int userdatasize = msg.ReadUBitLong(12);

			int userdatabits = msg.ReadUBitLong(4);
		}

		int compressed = msg.ReadOneBit();

		if (bits < 1) return true;

		unsigned int sz = (bits / 8) + 2;

		unsigned char* data = new unsigned char[sz*8]; //TODO: why is 8x the space required. (heap corruption otherwise)

		msg.ReadBits(data, bits);
		bool really_compressed = false;
		unsigned int actual_size;
		CLZSS s;
		printf("\n");
		{
			unsigned int remaining = sz;
			unsigned char* ptr = data;
			
			ptr += + 8; // unknown data

			remaining -= 8;
			really_compressed = s.IsCompressed(ptr);
			actual_size = really_compressed?s.GetActualSize(ptr):0;
			if (really_compressed) {
				unsigned char* data_dec = new unsigned char[actual_size];

				s.Uncompress(ptr, data_dec);

				// probably reuses the substring system used by old stringtable implementation. Shift the data by a bit or two to see the first entry of modelprecache for example.
				hexdump(data_dec, actual_size);

				delete[] data_dec;
				printf("\n");
			}
		}

		hexdump(data, bits / 8);
		

		delete[] data;


		printf("Received svc_CreateStringTable, name: %s | maxentries: %i | size: %d | entries: %i | compressed: %i,%s,%i | "							"bits: %i (%i bytes)\n", 
												name,		maxentries,		 size,		 entries,	compressed, really_compressed?"y":"n", actual_size, bits,bits/8);

		return true;
	}

	if (type == 13)//svc_UpdateStringTable
	{
		int tableid = msg.ReadUBitLong((int)MAX_TABLES_BITS);

		int changed = 1;

		if (msg.ReadOneBit() != 0)
		{
			changed = msg.ReadWord();
		}

		int bits = msg.ReadUBitLong(20);

		if (bits < 1)
			return true;

		char *data = new char[bits];

		msg.ReadBits(data, bits);

		delete[] data;


		printf("Received svc_UpdateStringTable, id: %i | changed: %i | bits: %i\n", tableid, changed, bits);

		return true;
	}

	if (type == 14)//svc_VoiceInit
	{
		char codec[255];
		msg.ReadString(codec, sizeof(codec));

		int quality = msg.ReadByte();


		printf("Received svc_VoiceInit, codec: %s | quality: %i\n", codec, quality);

		return true;
	}

	if (type == 15)//svc_VoiceData
	{

		//FIX ME PLEASE

		int client = msg.ReadByte();
		int proximity = msg.ReadByte();
		int bits = msg.ReadWord();

		if (msg.GetNumBitsLeft() < bits)
			bits = msg.GetNumBitsLeft();

		//if (!bits)//its just us talking
		//	return true;

		printf("Received svc_VoiceData, client: %i | proximity: %i | bits: %i\n", client, proximity, bits);



		char* voicedata = new char[(bits+8)/8];
		msg.ReadBits(voicedata, bits);

		if(voicetoggle)
		{
			char*uncompressed = new char[0xFFFF];
			unsigned int uncompressed_size = 0;
			
			
			EVoiceResult worked = clientaudio->DecompressVoice(voicedata, bits / 8, uncompressed, 0xFFFF, &uncompressed_size, clientaudio->GetVoiceOptimalSampleRate());

			if (worked == k_EVoiceResultOK)
			{
				HWAVEOUT hWaveOut = 0;
				WAVEHDR header = { uncompressed, uncompressed_size, 0, 0, 0, 0, 0, 0 };

				WAVEFORMATEX wfx = { WAVE_FORMAT_PCM, 1, clientaudio->GetVoiceOptimalSampleRate(), clientaudio->GetVoiceOptimalSampleRate()*2, 2, 16, sizeof(WAVEFORMATEX) };
				waveOutOpen(&hWaveOut, WAVE_MAPPER, &wfx, 0, 0, CALLBACK_NULL);

				waveOutPrepareHeader(hWaveOut, &header, sizeof(WAVEHDR));
				waveOutWrite(hWaveOut, &header, sizeof(WAVEHDR));

				waveOutUnprepareHeader(hWaveOut, &header, sizeof(WAVEHDR));
				waveOutClose(hWaveOut);
			}else{
				printf("RIP AUDIO: %i\n", worked);
				delete[] uncompressed;
			}
		

			delete[] voicedata;
			
		}





		if (voicemimic)
		{

			senddata.WriteUBitLong(10, 6);
			senddata.WriteWord(bits);
			senddata.WriteBits(voicedata, bits);

		}

		delete[] voicedata;


		return true;
	}

	if (type == 17)//svc_Sounds
	{
		int reliable = msg.ReadOneBit();

		int num = 1;
		int bits = 0;

		if (reliable == 0)
		{
			num = msg.ReadUBitLong(8);
			bits = msg.ReadUBitLong(16);
		}
		else {
			bits = msg.ReadUBitLong(8);
		}

		if (bits < 1)
			return true;

		char*data = new char[bits];
		msg.ReadBits(data, bits);

		delete[] data;

		//printf("Received svc_Sounds, reliable: %i, bits: %i, num: %i\n", reliable, bits, num);
		return true;
	}

	if (type == 18)//svc_SetView
	{
		int ent = msg.ReadUBitLong(MAX_EDICT_BITS);

		printf("Received svc_SetView, ent: %i\n", ent);
		return true;
	}

	if (type == 19)//svc_FixAngle
	{
		int relative = msg.ReadOneBit();

		float x = msg.ReadBitAngle(16);
		float y = msg.ReadBitAngle(16);
		float z = msg.ReadBitAngle(16);

		printf("Received svc_FixAngle, x:%f y: %f z: %f | relative: %i\n", x, y, z, relative);

		return true;
	}

	if (type == 20)//svc_CrosshairAngle
	{
		int p = msg.ReadUBitLong(16);
		int y = msg.ReadUBitLong(16);
		int r = msg.ReadUBitLong(16);
		
		printf("Received svc_CrosshairAngle p: %d y: %d r: %d\n", p, y, r);
	}

	if (type == 21)//svc_BSPDecal
	{

		Vector vec;
		msg.ReadBitVec3Coord(vec);

		int texture = msg.ReadUBitLong(9);
		int useentity = msg.ReadOneBit();

		int ent = 0;
		int modulation = 0;

		if (useentity == 1)
		{
			ent = msg.ReadUBitLong(MAX_EDICT_BITS);

			modulation = msg.ReadUBitLong(12);//fix me	

		}

		int lowpriority = msg.ReadOneBit();

		printf("Received svc_BSPDecal: pos: %f:%f:%f | tex: %i | useent: %i\n", vec.x, vec.y, vec.z, texture, useentity);

		return true;
	}

	if (type == 23)//svc_UserMessage
	{
		int msgtype = msg.ReadByte();
		int bits = msg.ReadUBitLong(MAX_USERMESSAGE_BITS);

		if (bits < 1)
			return true;

		char* data = new char[bits];

		msg.ReadBits(data, bits);

		bf_read userMsg(data, bits);

		if (msgtype == 3)
		{


			int client = userMsg.ReadByte();
			//int bWantsChat = userMsg.ReadByte();
			char readstr[MAX_USER_MSG_DATA];
			userMsg.ReadString(readstr, sizeof(readstr));

			int something3 = userMsg.ReadByte(); //idk, sometimes 1, might be bchat
			int something4 = userMsg.ReadByte(); //seems to be 1 when teamchatting
			int something5 = userMsg.ReadByte(); //idk, sometimes 1

			printf("Chat message: %i:%s __ %i\n", client, readstr, userMsg.GetNumBytesLeft());

			delete[] data;
			return true;
		}

		if (msgtype == 5)
		{
			userMsg.ReadByte();
			char readstr[MAX_USER_MSG_DATA];
			userMsg.ReadString(readstr, sizeof(readstr));

			printf("umsg print: %s\n", readstr);
		}
		if (msgtype == 44)//nwvar
		{
			int c**k = userMsg.ReadUBitLong(32);
			int cock2 = userMsg.ReadByte();

			char str[255];
			userMsg.ReadString(str, sizeof(str));

			char str2[255];
			userMsg.ReadString(str2, sizeof(str2));

			//printf("cock1:%i cock2: %i name: %s str2: %s | left: %i\n", c**k, cock2, str, str2,  userMsg.GetNumBytesLeft());

			delete[] data;
			return true;
		}

		delete[] data;

		printf("Received svc_UserMessage, type: %i | bits: %i\n", msgtype, bits);

		return true;
	}

	if (type == 24)//svc_EntityMessage
	{
		int ent = msg.ReadUBitLong(MAX_EDICT_BITS);
		int entclass = msg.ReadUBitLong(MAX_SERVER_CLASS_BITS);
		int bits = msg.ReadUBitLong(MAX_ENTITYMESSAGE_BITS);

		if (bits < 1)
			return true;

		char *data = new char[bits];
		msg.ReadBits(data, bits);

		delete[] data;

		printf("Received svc_EntityMessage, ent: %i | class: %i | bits: %i\n", ent, entclass, bits);

		return true;
	}

	if (type == 25)//svc_GameEvent
	{
		int bits = msg.ReadUBitLong(11);

		if (bits < 1)
			return true;

		char *data = new char[bits];
		msg.ReadBits(data, bits);

		delete[] data;

		printf("Received svc_GameEvent, bits: %i\n", bits);
		return true;
	}

	if (type == 26)//svc_PacketEntities
	{
		int max = msg.ReadUBitLong(MAX_EDICT_BITS);

		int isdelta = msg.ReadOneBit();

		int delta = -1;

		if (isdelta)
		{
			delta = msg.ReadLong();
		}

		int baseline = msg.ReadUBitLong(1);
		int changed = msg.ReadUBitLong(MAX_EDICT_BITS);
		int bits = msg.ReadUBitLong(20);

		int updatebaseline = msg.ReadOneBit();

		int bytes = bits / 8;

		if (bits < 1)
			return true;

		char *data = new char[bits];
		msg.ReadBits(data, bits);

		delete[] data;

		//printf("Received svc_PacketEntities, max: %i | isdelta: %i | line: %i | changed: %i | bits: %i | update: %i\n", max, isdelta, baseline, changed, bits, updatebaseline);


		return true;
	}

	if (type == 27)//svc_TempEntities
	{
		int num = msg.ReadUBitLong(8);
		int bits = msg.ReadVarInt32();

		if (bits < 1)
			return true;

		char *data = new char[bits];

		msg.ReadBits(data, bits);

		delete[] data;

		printf("Received svc_TempEntities, num: %i | bits: %i\n", num, bits);

		if (bconnectstep)
		{
			/*
			
			leynet_tcp tcp;
			printf("TCP TIME2\n");
			tcp.OpenConnection(serverip, serverport);//is that really the tcp port
			printf("CONNECTED: %s __ %i\n", serverip, serverport);

			senddata.Reset();

			memset(netsendbuffer, 0xFF, NETBUFFER_SIZE);

			tcp.Send("\x09", 1);
			Sleep(100);

			
			senddata.WriteUBitLong(10, 6);
			senddata.WriteWord(0xFFFF);

		

			for (int i = 0; i < 1000; i++)
			{
				senddata.WriteOneBit(i%2==0);
			}


				tcp.Send((const char*)senddata.GetData(), senddata.GetNumBytesWritten());

				*/
			senddata.WriteUBitLong(6, 6);
			senddata.WriteByte(6);
			senddata.WriteLong(netchan->m_iServerCount);

			senddata.WriteUBitLong(11, 6);
			senddata.WriteLong(net_tick);
			senddata.WriteUBitLong(1, 1);



			Sleep(2000);
			bconnectstep = 0;

		}

		return true;
	}

	if (type == 28)//svc_Prefetch
	{
		int index = msg.ReadUBitLong(4);

		printf("Received svc_Prefetch, index: %i\n", index);

		return true;
	}
	if (type == 30)//svc_GameEventList
	{
		int num = msg.ReadUBitLong(9);
		int bits = msg.ReadUBitLong(20);

		if (bits < 1)
			return true;

		char *data = new char[bits];
		msg.ReadBits(data, bits);

		printf("Received svc_GameEventList, num: %i | bits: %i\n", num, bits);

		delete[] data;

		return true;
	}

	if (type == 31)//svc_GetCvarValue
	{
		int cookie = msg.ReadUBitLong(32);


		char cvarname[255];
		msg.ReadString(cvarname, sizeof(cvarname));

		printf("Received svc_GetCvarValue, cookie: %i | name: %s\n", cookie, cvarname);

		return true;
	}

	if (type == 33)//svc_GMod_ServerToClient
	{
		int bits = msg.ReadUBitLong(20);
		int type = msg.ReadByte(); // 4= probably server telling about files

		if (bits < 1)
			return true;


		if (bits < 0)
		{
			printf("Received svc_Gmod_ServerToClient || Invalid!\n");

			return true;
		}

		if (type == 4)
		{
			
			char* data = new char[bits];


			int id = msg.ReadWord();

			int toread = bits - 8 - 16;
			if (toread > 0)
			{
				msg.ReadBits(data, toread);
			}



			printf("Received svc_GMod_ServerToClient, type: %i |  bits: %i  | id: %i \n", type, bits, id);

			delete[] data;

			return true;

		}

		if(type==3)
		{

			printf("Received svc_GMod_ServerToClient, type: %i |  bits: %i\n", type, bits);

			return true;
		}


		if (type == 0)
		{
		
			int id = msg.ReadWord();

			char* data = new char[bits];

			int toread = bits - 8 - 16;
			if (toread > 0)
			{
				msg.ReadBits(data, toread);
			}

			delete[] data;

			printf("Received svc_GMod_ServerToClient, type: %i |  bits: %i\n", type, bits);
			return true;
		}


		printf("Received svc_GMod_ServerToClient, type: %i |  bits: %i\n", type, bits);

		return true;
	}

	return false;
}