Traceur3RUN 75 Posted July 17, 2018 Share Posted July 17, 2018 how i can check client version in python? Link to comment Share on other sites More sharing options...
ridetpro 116 Posted July 17, 2018 Share Posted July 17, 2018 // 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 More sharing options...
Traceur3RUN 75 Posted July 18, 2018 Author Share Posted July 18, 2018 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 More sharing options...
ridetpro 116 Posted July 18, 2018 Share Posted July 18, 2018 // 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. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now