Jump to content

Get a string of constinfo from c++


Go to solution Solved by xP3NG3Rx,

Recommended Posts

Hi, someone know how get for example:

 

constinfo.py

Test = "Hello"

how can i get this "Hello" from c++? 

 

Im searching on the forum but i not found nothing, so i write here if somenone can help me.

 

Sorry my english, Thanks.

Link to comment
https://metin2.dev/topic/4107-get-a-string-of-constinfo-from-c/
Share on other sites

  • Premium

You can do it easily, I just don't get the point of it. 

 

 

Call this in your binary:

PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "GetTest", Py_BuildValue("()"));
Make a "GetTest" function in game.py:

	def GetTest(self):
		net.SetTest(constInfo.Test)
Add the receiver function to your binary:

object* netSetTest(PyObject* poSelf, PyObject* poArgs)
{
	char* szTest;
	if (!PyTuple_GetString(poArgs, 0, &szTest))
		return Py_BuildException();

	// Do something with szTest

	return Py_BuildNone();
}
I'm sure there is a better way to solve your problem, so please explain what you want to do.
  • Love 3
  • Honorable Member
  • Solution

Try this:

PyObject *pMod = PyImport_AddModule("constInfo");
PyObject *pVal = PyObject_GetAttrString(pMod, "Test");
char* var = PyString_AsString(pVal);
Py_DECREF(pVal);

printf("Test is: %s", var);
  • Love 3

Thanks sanchez and p3ng3r i go to try the 2 methods.

 

I want call a function return the constinfo 

 

"example in python"

 

self.get(self):

 return constInfo.Test

 

in c++

 

do a variable with the constInfo.Test

why don't you just do it in python ? :P

i can't xd

 

d0bb39efa18fd0592449bfbc41ef1eb3.png this i can't do with python xD

 

PD: I use the method of p3ng3r and when select character the client close without any log or sysser i go to try now with the method or sanchez.

 

PD2: I have this problem now:

6ad5c856b17f3a819fb41f81964db1fb.png8d8765c19bf4bbcdf50bedc0276b7d27.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Active+ Member

 

why don't you just do it in python ? :P

i can't xd

 

d0bb39efa18fd0592449bfbc41ef1eb3.png this i can't do with python xD

 

PD: I use the method of p3ng3r and when select character the client close without any log or sysser i go to try now with the method or sanchez.

 

PD2: I have this problem now:

6ad5c856b17f3a819fb41f81964db1fb.png8d8765c19bf4bbcdf50bedc0276b7d27.png

 

 

http://en.wikibooks.org/wiki/C++_Programming/Code/Standard_C_Library/Functions/printf

 

 %d a decimal integer

 :)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

 

 

why don't you just do it in python ? :P

i can't xd

 

d0bb39efa18fd0592449bfbc41ef1eb3.png this i can't do with python xD

 

PD: I use the method of p3ng3r and when select character the client close without any log or sysser i go to try now with the method or sanchez.

 

PD2: I have this problem now:

6ad5c856b17f3a819fb41f81964db1fb.png8d8765c19bf4bbcdf50bedc0276b7d27.png

 

 

http://en.wikibooks.org/wiki/C++_Programming/Code/Standard_C_Library/Functions/printf

 

 %d a decimal integer

  :)

 

O.o Thanks u i dont know c++ and i dont know the functions on c++ Thanks :)

 

The p3ng3r method is the shortest

 

Thanks to all, can close this topic is solved.

Edited by Metin2 Dev
Core X - External 2 Internal

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

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.