[CODE QUESTION] mob scanner

07/14/2020 13:09 ledinos1#1
Hey,
I wrote simple mober scanner using c++ and python's api. The problem is my dll crashes with 0xC0000409. I checked it with shorter loop and it worked sometimes. What could be the reason of that ? Maybe there is another, better way to scan mobs ? I would appreciate any hints ;)

Code:
PyObject* args = PyTuple_New(1);
PyObject* mod = PyObject_GetAttrString(PyImport_AddModule("player"), "GetCharacterDistance");
    for (int i = 0; i < 99999; i++) {
        PyTuple_SetItem(args, 0, PyInt_FromLong(i));
        PyObject* mob = PyObject_CallObject(mod, args);
        if (!mob) {
            Py_DECREF(mob);
            Py_XDECREF(args);
        }
        else {
            std::cout << i << std::endl;
        }
    }