|
如是
最近看到醉酒少女前辈的反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] |
|