Rejoin Packet

Status
Not open for further replies.

fahrein

Active member
Joined
Apr 18, 2014
Messages
103
Reaction score
0
When this work 0.3.7, but this dont work 0.3.7 R2 server.

Without call onplayerdisconnect public, join server?

Code:
sprintf_s(g_szNickName, 32, szNewPlayerName);
			strcpy(playerInfo[g_myPlayerID].szPlayerName, g_szNickName);

			int iVersion = NETGAME_VERSION;
			unsigned int uiClientChallengeResponse = settings.uiChallange ^ iVersion;
			BYTE byteMod = 1;

			char auth_bs[4*16] = {0};
			gen_gpci(auth_bs, 0x3e9);

			BYTE byteAuthBSLen;
			byteAuthBSLen = (BYTE)strlen(auth_bs);
			BYTE byteNameLen = (BYTE)strlen(g_szNickName);
			BYTE iClientVerLen = (BYTE)strlen(settings.szClientVersion);

			RakNet::BitStream bsSend;
			bsSend.Write(iVersion);
			bsSend.Write(byteMod);
			bsSend.Write(byteNameLen);
			bsSend.Write(g_szNickName, byteNameLen);
			
			bsSend.Write(uiClientChallengeResponse);
			bsSend.Write(byteAuthBSLen);
			bsSend.Write(auth_bs, byteAuthBSLen);
			bsSend.Write(iClientVerLen);
			bsSend.Write(settings.szClientVersion, iClientVerLen);

			pRakClient->RPC(&RPC_ClientJoin, &bsSend, HIGH_PRIORITY, RELIABLE, 0, FALSE, UNASSIGNED_NETWORK_ID, NULL);

Code:
int gen_gpci(char buf[64], unsigned long factor) /* by bartekdvd */
{
	unsigned char out[6*4] = {0};

	static const char alphanum[] =
		"0123456789"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	for (int i = 0; i < 6*4; ++i)
		out[i] = alphanum[rand() % (sizeof(alphanum) - 1)];

	out[6*4] = 0;

	BIG_NUM_MUL((unsigned long*)out, (unsigned long*)out, factor);

	unsigned int notzero = 0;
	buf[0] = '0'; buf[1] = '\0';

	if (factor == 0) return 1;

	int pos = 0;
	for (int i = 0; i < 24; i++)
	{
		unsigned char tmp = out[i] >> 4;
		unsigned char tmp2 = out[i]&0x0F;
		
		if (notzero || tmp)
		{
			buf[pos++] = (char)((tmp > 9)?(tmp + 55):(tmp + 48));
			if (!notzero) notzero = 1;
		}

		if (notzero || tmp2)
		{
			buf[pos++] = (char)((tmp2 > 9)?(tmp2 + 55):(tmp2 + 48));
			if (!notzero) notzero = 1;
		}
	}
	buf[pos] = 0;

	return pos;
}

[member=1371].silent[/member] [member=111]springfield[/member] [member=8182]ıllıllı 0β36 ıllıllı[/member] [member=9752]P3ti[/member]
 

.silent

Well-known member
Joined
Apr 14, 2013
Messages
339
Reaction score
13
I'm not into samp that much anymore, but as I saw Kye's "changelog" for 0.3.7 R2 there is this:
Adds protection against hackers who spam OnPlayerConnect messages.

So I guess he has finally decided to accept this packet only once (congratulations)
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
Rejoin packet works fine on 0.3.7 R2, you're doing something wrong.
 

fahrein

Active member
Joined
Apr 18, 2014
Messages
103
Reaction score
0
.silent link said:
I'm not into samp that much anymore, but as I saw Kye's "changelog" for 0.3.7 R2 there is this:
So I guess he has finally decided to accept this packet only once (congratulations)
Thank you for the comment , but I thought I was not trying to be working.

ıllıllı 0β36 ıllıllı link said:
Rejoin packet works fine on 0.3.7 R2, you're doing something wrong.
Thanks you for the comment. How does it work ? That 's where the code is incorrect ? Although you send me running EXE version of the open source or under or through private messages like this topic.
 
Status
Not open for further replies.
Top