找回密码
 点一下
查看: 1503|回复: 10

关于反MH的中的条件判断...问题出在了等待上面..

[复制链接]
发表于 2011-4-13 10:58:43 | 显示全部楼层 |阅读模式
如是
最近看到醉酒少女前辈的反MH.
然后想引用到地图中.但是我的地图中有全知药水....如果玩家使用的话.会被误判成MH.
本来我想的是加入一个变量判断.如果玩家X使用了全知药水.那么设定对应玩家的变量值为X.5秒后.再设定该值为Y.
当为X时.玩家被反MH捕捉到时就没有事.Y时就怀疑作弊.
但是
问题出在这个全知药水.是无CD的.玩家可以无时限的多次施放.
造成一次等待才开始.新一次等待又来了.前后冲突.造成反MH系统误判.

自己又想了想其它的办法.发现只要是用到这样的等待的.就都不可行....自己想不到更好的办法.
所以特地上来求助一下.谢谢.

[jass]//醉酒少女部分API函数
function H2I takes handle h returns integer
    return h
    return 0
endfunction
function H2S takes handle h returns string
    return I2S(H2I(h))
endfunction
function SetInt takes string h,string s,integer i returns nothing
    if i==0 then
        call FlushStoredInteger(udg_GC,h,s)
    else
        call StoreInteger(udg_GC,h,s,i)
    endif
endfunction
function GetGroup takes string h,string s returns group
    return GetStoredInteger(udg_GC,h,s)
    return null
endfunction
function GetUnit takes string h,string s returns unit
    return GetStoredInteger(udg_GC,h,s)
    return null
endfunction
function GetForce takes string h,string s returns force
    return GetStoredInteger(udg_GC,h,s)
    return null
endfunction

//醉酒少女出品,您若喜欢请保留此句
//若有其他需求请自行修改或联系醉酒少女
//以下数据移植时需要修改
function GetMHX takes nothing returns real
    return 2800. //MH马甲X坐标(在不可见区域内)
endfunction
function GetMHY takes nothing returns real
    return -3000.//MH马甲Y坐标(在不可见区域内)
endfunction
function GetMHViewTime takes nothing returns real
    return 0.005 //检查延迟时间
endfunction
function GetMHDetZoom takes nothing returns rect
    return Rect(2720,-3080,2880,-2920)//不可见区域
endfunction
function GetMHUnitType takes nothing returns integer
    return 'hpea'//MH马甲
endfunction
//以下如果不懂千万别动,后面有写可注释的除外
function IsPlayerAvailable takes player p returns boolean
    return GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p)==MAP_CONTROL_USER
endfunction
function DetLighning takes nothing returns nothing
    local real x=GetRandomReal(GetRectMinX(GetMHDetZoom()),GetRectMaxX(GetMHDetZoom()))
    local real y=GetRandomReal(GetRectMinY(GetMHDetZoom()),GetRectMaxY(GetMHDetZoom()))
    local lightning li
    if IsVisibleToPlayer(x,y,GetLocalPlayer())==false then
        set li=AddLightning("CLPB",true,x,y,x,y)
        if li!=null then
            call DestroyLightning(li)
            set li=null
            call SelectUnit(udg_MHCheatUnit[0],true)
        endif
    endif
    set li = null
endfunction
function HollyLight takes nothing returns nothing
    local unit u = udg_MHCheatUnit[0]
    local force f = GetForce("MHCheck","ZB")
    if GetFilterUnit()==u and IsPlayerInForce(GetTriggerPlayer(),f)==false and IsUnitVisible(u,GetTriggerPlayer())==false then
        call ForceAddPlayer(f,GetTriggerPlayer())
    endif
    set u = null
endfunction
function MiniMapCov takes nothing returns nothing
    if IsUnitVisible(GetFilterUnit(),GetLocalPlayer())then
        call UnitSetUsesAltIcon(GetFilterUnit(),false)
    else
        call UnitSetUsesAltIcon(GetFilterUnit(),true)
    endif
endfunction
function EnumMiniUnits takes nothing returns nothing
    local timer t = GetExpiredTimer()
    call GroupEnumUnitsInRect(GetGroup(H2S(t),"GMM"),bj_mapInitialPlayableArea,Filter(function MiniMapCov))
    set t = null
endfunction
function DetSeletion takes nothing returns nothing
    local integer ip=GetPlayerId(GetTriggerPlayer())
    if GetFilterUnit()!=udg_MHCheatUnit[1] then
        return
    endif
    set udg_MHTimePas[ip]=TimerGetElapsed(udg_MHTimer[ip])
    call PauseTimer(udg_MHview[ip])
    if GetLocalPlayer()==GetTriggerPlayer()then
        call SelectUnit(udg_MHCheatUnit[1],false)
    endif
    if IsUnitInvisible(GetTriggerUnit(),GetTriggerPlayer())then
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"Fog convert")
        set udg_MHTimePas[ip]=0
        call PauseTimer(udg_MHTimer[ip])
    endif
endfunction
function DetDeselection takes nothing returns nothing
    local integer ip=GetPlayerId(GetTriggerPlayer())
    if GetFilterUnit()!=udg_MHCheatUnit[1] then
        return
    endif
    if udg_MHTimePas[ip]==0 then
        return
    endif
    call PauseTimer(udg_MHTimer[ip])
    if TimerGetElapsed(udg_MHTimer[ip])-udg_MHTimePas[ip]>.01 then
        call ForceAddPlayer(GetForce("MHCheck","ZB"),GetTriggerPlayer())
    elseif TimerGetElapsed(udg_MHTimer[ip])-udg_MHTimePas[ip]==0 then
    endif
    set udg_MHTimePas[ip]=0
endfunction

function udg_DetZoomInit takes nothing returns nothing
    local integer ip=0
    local fogmodifier ZoomCov
    local timer AlltheTime=CreateTimer()
    local timer MiniProtectTime
    local trigger tri
    call SetInt("MHCheck","ZB",H2I(CreateForce()))
    set ZoomCov=CreateFogModifierRect(GetLocalPlayer(),ConvertFogState(1),GetMHDetZoom(),false,true)
    call FogModifierStart(ZoomCov)
    set udg_MHCheatUnit[0]=CreateUnit(Player(15),GetMHUnitType(),GetMHX(),GetMHY(),0)
    set tri=CreateTrigger()
    call TimerStart(AlltheTime,3,true,function DetLighning)
    loop
        exitwhen ip==12
        call TriggerRegisterPlayerUnitEvent(tri,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function HollyLight))
        set ip=ip+1
    endloop
    call SetAltMinimapIcon("MiniMapBlank.blp")
    set MiniProtectTime=CreateTimer()
    call SetInt(H2S(MiniProtectTime),"MMG",H2I(CreateGroup()))
    call TimerStart(MiniProtectTime,1,true,function EnumMiniUnits)
    set tri=CreateTrigger()
    set udg_MHCheatUnit[1]=CreateUnit(Player(15),GetMHUnitType(),GetMHX(),GetMHY(),0)
    set ip=1
    loop
        exitwhen ip>11
        if ip != 6 then
            if IsPlayerAvailable(Player(ip))then
                set udg_MHTimer[ip]=CreateTimer()
                set udg_MHTimePas[ip]=0
                call TriggerRegisterPlayerUnitEvent(tri,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function DetSeletion))
                call TriggerRegisterPlayerUnitEvent(tri,Player(ip),EVENT_PLAYER_UNIT_DESELECTED,Filter(function DetDeselection))
            endif
        endif
        set ip=ip+1
    endloop
    set ZoomCov = null
    set AlltheTime = null
    set MiniProtectTime = null
    set tri = null
endfunction
function ViewLoop takes nothing returns nothing
    local integer i=0
    loop
        exitwhen GetExpiredTimer()==udg_MHviewor i>12
        set i=i+1
    endloop
    call SetFogStateRadius(Player(i),FOG_OF_WAR_VISIBLE,GetMHX(),GetMHY(),300,false)
endfunction
function DeadLine takes nothing returns nothing
    call PauseTimer(GetExpiredTimer())
endfunction
function FirstSelect takes player p returns nothing
    local integer ip=GetPlayerId(p)
    if udg_MHview[ip]==null then
        set udg_MHview[ip]=CreateTimer()
    endif
    set udg_MHTimePas[ip]=0
    call TimerStart(udg_MHTimer[ip],5,false,function DeadLine)
    call TimerStart(udg_MHview[ip],GetMHViewTime(),true,function ViewLoop)
    call SetFogStateRadius(p,FOG_OF_WAR_VISIBLE,GetMHX(),GetMHY(),300,false)
    if GetLocalPlayer()==p then
        call SelectUnit(udg_MHCheatUnit[1],true)
    endif
endfunction
function Trig_democ_Actions takes nothing returns nothing
    local integer i=0
    local string s = "开始检测MH"
    call DisableTrigger(GetTriggeringTrigger())   
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"MH检查系统第二版(By醉酒少女)")
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,s)
    call ForceClear( GetForce("MHCheck","ZB") )
    loop
        exitwhen i==12
        if IsPlayerAvailable(Player(i))then
            call FirstSelect(Player(i))
        endif
        set i=i+1
    endloop
    call TriggerSleepAction(2)
    set i=1
    loop
        exitwhen i>11
        if i != 6 then
            if IsPlayerAvailable(Player(i))then
                if IsPlayerInForce(Player(i),GetForce("MHCheck","ZB"))then
                    set s = "|cFFFF0000" + I2S(i+1) + "-" + GetPlayerName(Player(i)) + "-可能作弊!|r"
                    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,s)
                endif
            endif
        endif
        set i=i+1
    endloop
    set s = "检查完毕"
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,s)
    call EnableTrigger(GetTriggeringTrigger())
endfunction
function MH_Kick takes nothing returns nothing
    local string s = GetEventPlayerChatString()
    local integer id = S2I(SubString(s, 6, 8))
    if IsPlayerInForce(Player(id-1),GetForce("MHCheck","ZB")) then
        set s = "您因作弊被踢出游戏!"
        call CustomDefeatBJ( Player(id-1), s )
    endif
    set s = null
endfunction
//===========================================================================
function InitTrig_mh takes nothing returns nothing
    local trigger tri = CreateTrigger()
    set gg_trg_mh = CreateTrigger()
    set udg_GC = InitGameCache("ZuiJiuShaoNv")
    call udg_DetZoomInit()
    call TriggerRegisterPlayerChatEvent( gg_trg_mh, Player(1), "-mh", true )
    call TriggerAddAction( gg_trg_mh, function Trig_democ_Actions )
    call TriggerRegisterPlayerChatEvent( tri, Player(1), "-kick", false )
    call TriggerAddAction( tri, function MH_Kick )
    set tri = null
endfunction
[/jass]
发表于 2011-4-13 12:03:30 | 显示全部楼层
用计时器代替等待。
回复

使用道具 举报

 楼主| 发表于 2011-4-13 12:30:07 | 显示全部楼层
引用第1楼希瓦于2011-04-13 12:03发表的 :
用计时器代替等待。

...感谢希瓦..
但是还是想不太明白....
先去试试...
回复

使用道具 举报

发表于 2011-4-13 12:36:37 | 显示全部楼层
计时器运行的话会覆盖先前运行的~
回复

使用道具 举报

发表于 2011-4-13 13:39:12 | 显示全部楼层
[trigger]AK
    事件
        单位 - 任意单位 使用物品
    条件
        ((被操作物品) 的类型) 等于 全知药水
    动作
        触发器 - 关闭 (对于(触发玩家)的MH检测)
        计时器 - 开启 Timer[((触发玩家) 的玩家索引号)] ,计时方式: 一次性 时间设置: 5.00 秒
[/trigger]

[trigger]CM
    事件
        时间 - Timer[1] 到期
        时间 - Timer[2] 到期
        时间 - Timer[3] 到期
        时间 - Timer[4] 到期
    条件
    动作
        触发器 - 开启 (与计时器对应的玩家的MH检测)
[/trigger]
大概思路就是这样
回复

使用道具 举报

 楼主| 发表于 2011-4-13 13:48:46 | 显示全部楼层
感谢LS和LSS.

擦汗自己做了一下还是不行...感觉自己是在捕捉计时器这里出了问题.
我在反MH的判断中又加了一个整数大小判断.
用数组+玩家引索的值为1时,就是使用状态,为0时就是没有使用..
但是我发现,计时器到期那里成问题哦....因为我不怎么用计时器...
计时器到期的时候.不知道该如何捕捉对应的玩家引索...所以就用了YDWE里面的函数
YDWE_TP_GetExpiredTimerIndex 到期的计时器引索..不过感觉自己好像没有用对...
希望高手给看一下.
加入整数条件判断....

[jass]
if IsPlayerInForce(Player(i),GetForce("MHCheck","ZB"))then
                   if udg_FCT[GetPlayerId(Player(i))] == 0 then
                    set s = "|cFFFF0000" + I2S(i+1) + "-" + GetPlayerName(Player(i)) + "-可能作弊!|r"
[/jass]

使用物品后玩家对应的开启计时器...[trigger]
    事件
        单位 - 任意单位 发动技能效果
    条件
        (施放技能) 等于 能显示整个地图的物品
    动作
        计时器 - 启动 KOFys[(((触发单位) 的所有者) 的玩家索引号)],应用计时方式: 一次性,计时周期为 0.00 秒
        设置 FCT[(((触发单位) 的所有者) 的玩家索引号)] = 1
[/trigger]
获得到期的计时器引索.然后通过这个引索得到变量.把变量变成0.但是这里应该是失败了....

[jass]
function Trig_2_Actions takes nothing returns nothing
    set udg_FCT[YDWE_TP_GetExpiredTimerIndex()] = 0
    call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|cFF1BE6B8让我们看看到期的问题|r"+I2S(YDWE_TP_GetExpiredTimerIndex)+"玩家"+I2S(udg_FCT[YDWE_TP_GetExpiredTimerIndex()]))
    call PauseTimer(GetExpiredTimer())
endfunction

//===========================================================================
function InitTrig_2 takes nothing returns nothing
    local integer i = 0
    set gg_trg_2 = CreateTrigger(  )
    loop
    exitwhen i > 13
    call TriggerRegisterTimerExpireEventBJ( gg_trg_2, udg_KOFys )
    set i = i+ 1
    endloop
    call TriggerAddAction( gg_trg_2, function Trig_2_Actions )
endfunction
[/jass]



回复

使用道具 举报

 楼主| 发表于 2011-4-13 13:52:53 | 显示全部楼层
引用第4楼希瓦于2011-04-13 13:39发表的 :[trigger]AK
    事件
        单位 - 任意单位 使用物品
    条件
        ((被操作物品) 的类型) 等于 全知药水
.......

擦汗.刚才还没有看到的说....
如果如希瓦所说.那么这样的话.反MH就不能使用我发的那样--动态注册事件...
而是每个玩家写一个?..然后每个运行一下..

能不能帮我看看我LS想的那个办法可行吗?
给所有玩家分配一个计时器.一个变量
.这个变量为1时.就判断作弊.为0时判定作弊.
谢谢.
回复

使用道具 举报

发表于 2011-4-14 08:28:27 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2011-4-14 12:42:24 | 显示全部楼层
楼主如果想要我们帮你检查触发的话,就把地图发上来吧。
不然,这么一大段的JASS,还连使用说明都没有一句……
难道你想要每一个回答者都去重做一个系统??

如果是这样,我们也只能回你一个思路,你自己去试吧…………
回复

使用道具 举报

发表于 2011-4-14 19:18:27 | 显示全部楼层
其实这里有两个检测机制~
一个是利用闪电
一个是选择不可见单位
所以你只改一个是不行的,要改需要2个一起改~

然后最近又研究了一个新反MH
嘿嘿~有空我再发出来,利用的是反过来的原理,在必定看得见的地方选择单位
回复

使用道具 举报

 楼主| 发表于 2011-4-15 10:54:00 | 显示全部楼层
引用第8楼希瓦于2011-04-14 12:42发表的 :
楼主如果想要我们帮你检查触发的话,就把地图发上来吧。
不然,这么一大段的JASS,还连使用说明都没有一句……
难道你想要每一个回答者都去重做一个系统??

如果是这样,我们也只能回你一个思路,你自己去试吧…………

抱歉.没有那个意思哦...
地图我发上来了...请帮忙看一下吧...
自动检查 MHCheck-V2.0.w3x (38 KB, 下载次数: 19)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-7-4 07:34 , Processed in 0.083881 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表