- 最后登录
- 2019-12-25
- 注册时间
- 2012-8-24
- 阅读权限
- 90
- 积分
- 71088
 
- 纳金币
- 52344
- 精华
- 343
|
来自:safdds
最近在做防止外挂的问题,一般内存变量访问就是对他加密就行了,但是如果是加速器的话,它是修改了clock_getime的Libc.so相关代码实现加速功能,这样update调用次数会增加,所以最近我写了个代码做检验,一刀一个小朋友,看他还敢用外挂,下面贴上代码:- public class SpeedPlugCheck : MonoBehaviour {
- // Use this for initialization
- public float GamestartToCurrTime = 0;
- public float GameRunTime =0;
- public float LerpValue = 0;
- public bool IsSpeedPlugCheck = false;
- void Start () {
-
- }
-
- // Update is called once per frame
- void Update () {
- GamestartToCurrTime = Time.realtimeSinceStartup;
- GameRunTime += Time.deltaTime;
- LerpValue = GamestartToCurrTime - GameRunTime;
- if (LerpValue < 0&& IsSpeedPlugCheck==false)
- {
- IsSpeedPlugCheck = true;
- Debug.Log("使用外挂");
- }
- }
- }
复制代码 |
|