Cuberite Forum
AntiCheat - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: AntiCheat (/thread-1373.html)

Pages: 1 2 3


RE: AntiCheat - daniel0916 - 03-11-2014

How can i use the ScheduleTask function of the World in C++?
I need the DelayTicks and cTask. What is cTask and how can i create them?


RE: AntiCheat - xoft - 03-11-2014

cTask is an interface class. When you want to use it, you declare a new class that derives from it, and overrides its Execute method. Then you create a new instance of that class on the heap (new cMyTask(...)) and pass that to cWorld::ScheduleTask()


RE: AntiCheat - daniel0916 - 03-12-2014

How must be the code to use a method as variable in cAntiCheatTask?
Current Code:
#pragma once

#include "../World.h"





class cAntiCheatTask :
	public cWorld::cTask
{
public:
	cAntiCheatTask()
	{
	}

protected:
	virtual void Run(cWorld & a_World) override
	{


	}
};



RE: AntiCheat - xoft - 03-12-2014

Just add a member variable and possibly initialize it in the constructor, or provide a setter to call:
class cAntiCheatTask :
    public cWorld::cTask
{
public:
    cAntiCheatTask(int a_Var1) :
        m_Var1(a_Var1)
    {
    }

    void SetVar2(int a_Var2)
    {
        m_Var2 = a_Var2;
    }
 
protected:
    int m_Var1;
    int m_Var2;

    virtual void Run(cWorld & a_World) override
    {
        int Total = m_Var1 + m_Var2;  // example
    }
};



RE: AntiCheat - ruhula - 03-15-2014

nice ;D


RE: AntiCheat - jan64 - 09-09-2014

This thread seems to be abandoned, however, if someone is still interested in how to detect mods,
You can always take a look how does the nocheat does it.

https://github.com/NoCheatPlus/NoCheatPlus