Jump to content

check Client_version in python


Recommended Posts

// PythonNetworkStreamModule.cpp

PyObject* netSendVersionPacket(PyObject* poSelf, PyObject* poArgs)
{
	CPythonNetworkStream &rkNetStream = CPythonNetworkStream::Instance();
	rkNetStream.SendClientVersionPacket();
	return Py_BuildNone();
}

// static PyMethodDef s_methods[] =

{ "SendVersionPacket", netSendVersionPacket, METH_VARARGS },

This function have no argument, it will just send the version from this function.

bool CPythonNetworkStream::SendClientVersionPacket()
// this line
	strncpy(kVersionPacket.timestamp, 1111111, sizeof(kVersionPacket.timestamp) - 1); // 111111 IS THE CLIENT VERSION

 

 

Do you want a function in python Like this ?

net.SendClientVersionPacket(123456)

 

Link to comment
Share on other sites

16 godzin temu, ridetpro napisał:

// PythonNetworkStreamModule.cpp

PyObject* netSendVersionPacket(PyObject* poSelf, PyObject* poArgs)
{
	CPythonNetworkStream &rkNetStream = CPythonNetworkStream::Instance();
	rkNetStream.SendClientVersionPacket();
	return Py_BuildNone();
}

// static PyMethodDef s_methods[] =

{ "SendVersionPacket", netSendVersionPacket, METH_VARARGS },

This function have no argument, it will just send the version from this function.


bool CPythonNetworkStream::SendClientVersionPacket()
// this line
	strncpy(kVersionPacket.timestamp, 1111111, sizeof(kVersionPacket.timestamp) - 1); // 111111 IS THE CLIENT VERSION

 

 

Do you want a function in python Like this ?


net.SendClientVersionPacket(123456)

 

yes something like this

 

if getClientVersion(12345) then

--todo

end

Link to comment
Share on other sites

// PythonNetworkStreamPhaseGame.cpp
// Under  bool CPythonNetworkStream::SendClientVersionPacket() from
// add

bool CPythonNetworkStream::SendClientVersionPacketNew(int32_t arg)
{
	auto ver_arg = std::to_string(arg);

	std::string filename;
	GetExcutedFileName(filename);
	filename = CFileNameHelper::NoPath(filename);
	CFileNameHelper::ChangeDosPath(filename);
	TPacketCGClientVersion kVersionPacket;
	kVersionPacket.header = HEADER_CG_CLIENT_VERSION;
	strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename) - 1);
	strncpy(kVersionPacket.timestamp, ver_arg.c_str(), sizeof(kVersionPacket.timestamp) - 1);

	if (!Send(sizeof(kVersionPacket), &kVersionPacket))
	{
		Tracef("SendClientReportPacket Error");
	}

	return true;
}

//PythnNetworkStram.h 
//	bool SendClientVersionPacket(); Under
// add

	bool SendClientVersionPacketNew(int32_t arg);

// PythonNetwoStramModule.cpp
PyObject* netSendCheckVersionPacket(PyObject* poSelf, PyObject* poArgs)
{
	int32_t iVer;

	if (!PyTuple_GetInteger(poArgs, 0, &iVer))
	{
		return Py_BuildException();
	}

	CPythonNetworkStream &rns = CPythonNetworkStream::Instance();
	rns.SendClientVersionPacketNew(iVer);
	return Py_BuildNone();
}

// static PyMethodDef s_methods[] =

{ "SendVersionPacket", netSendVersionPacket, METH_VARARGS },

 

Python usage

def IsVersion(self, arg)
	net.SendClientVersionPacket(arg)


if IsVersion(1111)
	#Do stuff

I did not test it.

:)

  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.