Help! Using “Contains”

·҉ dollaz·҉. .

Awesome Active Platinian
Aight so I been tryna use Contains to get a player in an with an ID
6CAC4DAF-77B9-44A2-A3FF-E17D4F517DA9.png

I must be wrong about the way I’m using it cause I get this error

9A4685E8-22BF-4F8D-BC01-517E700A7D52.png

Does anyone know the right way to use it? Or a way I could fix what I got going on

This is the monoArray struct I’m using
C++:
template <typename T>
struct monoArray
{

    void* klass;
    void* monitor;
    void* bounds;
    int   max_length;
    void* vector [1];
    int getLength()
    {
        return max_length;
    }
    T getPointer()
    {
        return (T)vector;
    }
    T operator [] (int i)
    {
        return getPointer()[i];
      }

      const T operator [] (int i) const
    {
        return getPointer()[i];
      }

      bool Contains(T item)
    {
        for (int i = 0; i < max_length; i++)
    {
            if(getPointer()[i] == item) return true;
        }
        return false;
    }
};
 
Last edited:
C++:
T getPointer() {
    return (T)vector;
}
should be
C++:
T* getPointer() {
    return (T*) &vector;
}
Also, all template types have to be the same. So if you have monoArray<void*>, you must pass a void* to Contains
 
Back
Top Bottom