wc3edit.net
https://forum.wc3edit.net/

Script that auto-kicks a "spoofer"
http://forum.wc3edit.net/deprotection-cheating-f64/script-that-auto-kicks-a-spoofer-t24713.html
Page 1 of 3

Author:  risker [ April 24th, 2012, 2:23 am ]
Post subject:  Script that auto-kicks a "spoofer"

Basically, I want particular usernames to be password locked. They have to say the password within ten seconds of the map starting, or they'll be kicked for not authenticating themselves.

Author:  naturesfury [ April 24th, 2012, 3:17 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

make a timer single event at like 10 sec (i'd wait for like 30 or something as some people lag...)

function exampleaction takes nothing returns nothing
local integer i=0
local boolean var=true
loop
exitwhen i>11
if GetPlayerName(Player(i))=="whateverusername" and not var then
call CustomDefeatBJ(Player(i),"Die spoofer!! or whatever")
endif
set i=i+1
endloop
endfunction

copy from if to endif with a diff username/message for every diff username
then another trigger to set that variable. you can set the variable to whatever you want when they authenticate, just used true in the example

Author:  haxorico [ April 24th, 2012, 3:19 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

Under globals
Spoiler:
Code:
constant string PASSWORD="i am not a spoofer"
constant real TIME_TO_WAIT=10.0
trigger trgChat=CreateTrigger()
boolean array users

Under endglobals
Spoiler:
Code:
function kickSpoofers takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
if users[i] then
call CustomDefeatBJ(Player(i),"Don't spoof my name.")
endif
set i=i+1
endloop
call DisableTrigger(trgChat)
call DestroyTrigger(trgChat)
endfunction

function authorizeUser takes nothing returns nothing
set users[GetPlayerId(GetTriggerPlayer())]=false
endfunction

function isUserNameSaved takes integer playerNumber returns boolean
local string s=StringCase(GetPlayerName(Player(playerNumber)),false)
if (s=="admin1") or (s=="admin2") or (s=="admin3") then
set s=""
return true
endif
set s=""
return false
endfunction

function checkSpoof takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
call TriggerRegisterPlayerChatEvent(trgChat,Player(i),PASSWORD,false)
set users[i]=isUserNameSaved(i)
set i=i+1
endloop
call TriggerAddAction(trgChat,function authorizeUser)
call TriggerSleepAction(TIME_TO_WAIT)
call kickSpoofers()
endfunction


under function main
Code:
call checkSpoof()


I didn't test it, but it should work.

Author:  naturesfury [ April 24th, 2012, 3:35 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

LOL nice,
forget mine, use his xP

Author:  risker [ April 24th, 2012, 4:34 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

I put this together;

Code:

function Trig_Antispoof1_Func001001001001 takes nothing returns boolean
    return ( GetPlayerController(GetFilterPlayer()) == MAP_CONTROL_USER )
endfunction

function Trig_Antispoof1_Func001001001002 takes nothing returns boolean
    return ( GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING )
endfunction

function Trig_Antispoof1_Func001001001 takes nothing returns boolean
    return GetBooleanAnd( Trig_Antispoof1_Func001001001001(), Trig_Antispoof1_Func001001001002() )
endfunction

function Trig_Antispoof1_Func001Func001C takes nothing returns boolean
    if ( not ( GetPlayerName(GetEnumPlayer()) == "risker[MN]" ) ) then
        return false
    endif
    return true
endfunction

function Trig_Antispoof1_Func001A takes nothing returns nothing
    if ( Trig_Antispoof1_Func001Func001C() ) then
    else
    endif
endfunction

function Trig_Antispoof1_Actions takes nothing returns nothing
    call ForForce( GetPlayersMatching(Condition(function Trig_Antispoof1_Func001001001)), function Trig_Antispoof1_Func001A )
endfunction

//===========================================================================
function InitTrig_Antispoof1 takes nothing returns nothing
    set gg_trg_Antispoof1 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Antispoof1, function Trig_Antispoof1_Actions )
endfunction


function Trig_password_part_2_Func001Func001001001 takes nothing returns boolean
    return ( GetPlayerName(GetTriggerPlayer()) == "risker[MN]" )
endfunction

function Trig_password_part_2_Func001C takes nothing returns boolean
    if ( not ( GetEventPlayerChatString() == "Hai" ) ) then
        return false
    endif
    return true
endfunction

function Trig_password_part_2_Actions takes nothing returns nothing
    if ( Trig_password_part_2_Func001C() ) then
        call DisplayTextToForce( GetPlayersMatching(Condition(function Trig_password_part_2_Func001Func001001001)), "TRIGSTR_004" )
    else
        call QueuedTriggerRemoveBJ( GetTriggeringTrigger() )
        call QueuedTriggerAddBJ( GetTriggeringTrigger(), true )
        call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_001" )
    endif
endfunction

//===========================================================================
function InitTrig_password_part_2 takes nothing returns nothing
    set gg_trg_password_part_2 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_password_part_2, function Trig_password_part_2_Actions )
endfunction

Author:  Kyoshiro [ April 24th, 2012, 4:43 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

Code:
function Trig_Antispoof1_Func001A takes nothing returns nothing
    if ( Trig_Antispoof1_Func001Func001C() ) then
    else
    endif
endfunction

what?

Author:  risker [ April 24th, 2012, 4:49 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

Something tells me thats missing something. *rubshead*

Oh and I forgot the thing to trigger it. ^_^

Code:
function Trig_trigger_Actions takes nothing returns nothing
    call TriggerExecute( gg_trg_Antispoof1 )
endfunction

//===========================================================================
function InitTrig_trigger takes nothing returns nothing
    set gg_trg_trigger = CreateTrigger(  )
    call TriggerAddAction( gg_trg_trigger, function Trig_trigger_Actions )
endfunction

Author:  haxorico [ April 24th, 2012, 4:55 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

I think you forgot to add the globals.

gg_trg_trigger=null
gg_trg_Antispoof1=null
gg_trg_password_part_2=null

and all the TRIGSTR_XXX are saved in the war3map.wts file, so that data is missing also.

Author:  risker [ April 24th, 2012, 4:56 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

I think I'll just go with your script. :P

EDIT:

Also, instead of a typical defeat. I was thinking of using the
Code:
Trigger - Remove (This trigger) from the trigger queue
Trigger - Add (This trigger) to the trigger queue (Checking conditions)
to cause the game to crash, making them alt+f4 but I believe that'd crash everyone and not just the particular player?

Author:  haxorico [ April 24th, 2012, 5:08 am ]
Post subject:  Re: Script that auto-kicks a "spoofer"

I never checked crushing mechanics because I found one that is just the coolest, but that is kept for me, mainly cause its just funny, but it crashes for everyone :O

Page 1 of 3 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/