- Joined
- Mar 15, 2012
- Messages
- 2,885
Awesome if this really works and by the way speed hacking in multiplayer without disconnecting is now possible. Has been for a while.
// ********************************************************
//
// Speed Hack Detection v1.1
//
// ---------------------------------------------------
//
// Detects when a player are using speed hacking program
// to boost up the game speed. The system only works if
// only the player has the sound system working and enabled.
// So it's recommended to require them to enable the sound
// system just like what's demonstrated.
//
// Installation:
// 1. Import the sound file
// 2. Copy the SHD trigger group to your map
// 3. Copy SHDetectionDummy unit to your map
// 4. Configure the system accordingly
//
// Events:
// udg_SHD__Event equals to 1.00 => speed hack detected
// udg_SHD__Event equals to 2.00 => sound system disabled
// udg_SHD__Event equals to 3.00 => sound system enabled
//
// ********************************************************
constant function SHD__DummyID takes nothing returns integer
return 'h000' // SHDetectionDummy raw code
endfunction
constant function SHD__FilePath takes nothing returns string
return "war3mapImported\\SpeedHackDetector.mp3"
endfunction
constant function SHD__FileDuration takes nothing returns real
return 1.1
endfunction
constant function SHD__RetryThreshold takes nothing returns integer
return 25
endfunction
function SHD__OnSelect takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer id
set udg_SHD__TriggeringPlayer = GetTriggerPlayer()
set id = GetPlayerId(udg_SHD__TriggeringPlayer)
if (u == udg_SHD__EventSync) then
set udg_SHD__EventIndex[id] = udg_SHD__EventIndex[id] + 1
elseif (u == udg_SHD__EventSyncEnd) then
set udg_SHD__Event = udg_SHD__EventIndex[id]
set udg_SHD__Event = 0
set udg_SHD__EventIndex[id] = 0
endif
set udg_SHD__TriggeringPlayer = null
set u = null
return false
endfunction
function SHD__BuildEvent takes integer index returns nothing
loop
set index = index-1
call SelectUnit(udg_SHD__EventSync, true)
call SelectUnit(udg_SHD__EventSync, false)
exitwhen index == 0
endloop
call SelectUnit(udg_SHD__EventSyncEnd, true)
call SelectUnit(udg_SHD__EventSyncEnd, false)
endfunction
function SHD__Check takes nothing returns nothing
if (udg_SHD__IsSoundPlaying and GetSoundIsPlaying(udg_SHD__Sound)) then
call StopSound(udg_SHD__Sound, false, false)
call SHD__BuildEvent(1)
endif
call StartSound(udg_SHD__Sound)
set udg_SHD__IsSoundPlaying = GetSoundIsPlaying(udg_SHD__Sound)
if (not udg_SHD__IsSoundPlaying) then
if (udg_SHD__IsSoundEnabled) then
call SHD__BuildEvent(2)
set udg_SHD__IsSoundEnabled = false
endif
elseif (not udg_SHD__IsSoundEnabled) then
call SHD__BuildEvent(3)
set udg_SHD__IsSoundEnabled = true
endif
endfunction
function SHD__Preload takes nothing returns nothing
call StartSound(udg_SHD__Sound)
if (GetSoundIsPlaying(udg_SHD__Sound)) then
call StopSound(udg_SHD__Sound, false, false)
call TimerStart(udg_SHD__Checker, SHD__FileDuration(), true, function SHD__Check)
debug call BJDebugMsg("Preloading completed after " + I2S(udg_SHD__Counter) + "x attempts")
elseif (udg_SHD__Counter < SHD__RetryThreshold()) then
set udg_SHD__Counter = udg_SHD__Counter + 1
elseif (udg_SHD__IsSoundEnabled) then
call TimerStart(udg_SHD__Checker, SHD__FileDuration(), true, function SHD__Check)
call SHD__BuildEvent(2)
set udg_SHD__IsSoundEnabled = false
endif
endfunction
function InitTrig_SHDetection takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set udg_SHD__IsSoundEnabled = true
set udg_SHD__EventSync = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), SHD__DummyID(), 0, 0, 0)
set udg_SHD__EventSyncEnd = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), SHD__DummyID(), 0, 0, 0)
set udg_SHD__Sound = CreateSound(SHD__FilePath(), false, false, false, 0, 0, "")
loop
exitwhen i > 11
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
endloop
call TriggerAddCondition(t, Condition(function SHD__OnSelect))
call TimerStart(udg_SHD__Checker, 0.01, true, function SHD__Preload)
call PauseUnit(udg_SHD__EventSync , true)
call PauseUnit(udg_SHD__EventSyncEnd, true)
endfunction