----------------------------------------------------------------------------------------------------- -- Lua Guardian -- Anti Spawn Kill Bot -- created by Hadro -- contact adr7777@hotmail.com -- Battery version by GhosT:McSteve -- this is a modified version of Hadro's fueldump bot, which prevent axis going on the beach -- 16/1/06 ----------------------------------------------------------------------------------------------------- -- many thanks to the regulars from 'shiven.net ** 24/7 action' -- for putting up with my genocidal beta tests =) ----------------------------------------------------------------------------------------------------- -- origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] -- checks if a player is in a box with lowest coordinates origin[1,2,3] and highest coordinates endpt[1,2,3] -- -- (ppos[1] - origin[1])^2 + (ppos[2] - origin[2])^2 + (ppos[3] - origin[3])^2 < radius^2 -- checks if a player is in a sphere with center origin[1,2,3] and radius -- spheres are not used for the fueldump map ----------------------------------------------------------------------------------------------------- version = "1.0" samplerate = 500 -- bot will check player positions every x milliseconds function et_RunFrame(levelTime) --[[ this is not necessary, its simply a map announce I placed in here for convenience -- ANNOUNCE THE MAP NAME HERE if levelTime == (maptime + 7000) then et.trap_SendServerCommand(-1, string.format("cp \"^fThe current map is: ^g%s \"\n", string.upper(mapname) ) ) return end ]] if math.mod(levelTime, samplerate) ~= 0 then return end if mapname ~= "battery" then return end for cno=0, num_cl-1, 1 do phealth = et.gentity_get(cno, "health") if phealth > 0 then msg = nil ppos = et.gentity_get(cno,"r.currentOrigin") teamnum = et.gentity_get(cno, "sess.sessionTeam") if teamnum == 1 then -- if you are Axis: if batteryspawnswitch == 1 then temp = 1 else -- SG box1 - assault ramp close origin = { 1408, -2800, 508 } endpt = { 2096, -2320, 912 } if origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] then msg = "%s^7's rambo beach invasion was thwarted by beach-bot" end --box1 -- SG box2 - assault ramp far origin = { 1056, -2304, 508 } endpt = { 2432, -1920, 912 } if origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] then msg = "%s^7's rambo beach invasion was thwarted by beach-bot" end --box2 --SG box3 - rear path origin = { 4480, -2292, 776 } endpt = { 5120, -1664, 1180 } if origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] then msg = "%s^7's rambo beach invasion was thwarted by beach-bot" end --box3 --SG box4 - rear beach origin = { 3232, -2044, 336 } endpt = { 4476, -1276, 1180 } if origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] then msg = "%s^7's rambo beach invasion was thwarted by beach-bot" end --box4 --SG box5 - near gun outer, assault-ramp side origin = { 2176, -2432, 896 } endpt = { 2560, -2048, 1296 } if origin[1] < ppos[1] and ppos[1] < endpt[1] and origin[2] < ppos[2] and ppos[2] < endpt[2] and origin[3] < ppos[3] and ppos[3] < endpt[3] then msg = "%s^7's rambo beach invasion was thwarted by beach-bot." end --box5 end --if batteryspawnswitch ==1 end -- if axis if msg ~= nil then --[[ --original function to kill player et.gentity_set(cno, "health", -511) soundindex = et.G_SoundIndex( "/sound/player/gib.wav" ) et.G_Sound( cno , soundindex ) ]] --explanation - et.G_Damage( target, inflictor, attacker, damage, dflags, mod ) --attacker = cno for "ETPlayer killed himself" message et.G_Damage( cno, 80, cno, 1000, 8, 34 ) --attacker = 1022 for "ETPlayer was crushed" message --et.G_Damage( cno, 80, 1022, 1000, 8, 34 ) --soundindex = et.G_SoundIndex( "/sound/player/gib.wav" ) --soundindex = et.G_SoundIndex( "/sound/etpro/osp_goat.wav" ) --et.G_Sound( cno , soundindex ) msg = string.format(msg, et.Info_ValueForKey(et.trap_GetUserinfo(cno), "name")) msg = string.format("qsay %s\n", msg) et.trap_SendConsoleCommand(et.EXEC_APPEND, msg) et.trap_SendServerCommand(cno, "cp \"^3Stay away from the beach.\"\n" ) end end -- if health > 0 end -- for loop end function et_ClientCommand(cno, cmd) if cmd ~= "say" then return 0 end if string.lower(et.ConcatArgs(1)) ~= "!luatest" then return 0 end et.trap_SendConsoleCommand(et.EXEC_APPEND, "qsay \"^3test for ^6Lua ^7Guardian - Anti Spawn Kill Bot\"\n") if mapname == "battery" then tosend = string.format("qsay \"^3>version ^7%s ^3sampling at ^7%d ^3milliseconds\"\n", version, samplerate) tosend = string.format("qsay \"batteryspawnswitch = %d \"\n", batteryspawnswitch) et.trap_SendConsoleCommand(et.EXEC_APPEND, tosend) else tosend = string.format("qsay \"^3>version ^7%s ^3no parameters set for ^7%s ^3map\"\n", version, mapname) et.trap_SendConsoleCommand(et.EXEC_APPEND, tosend) end return 0 end function et_InitGame(levelTime, randomSeed, restart) num_cl = et.trap_Cvar_Get("sv_maxclients") mapname = et.trap_Cvar_Get("mapname") origin = {} endpt = {} switchcounter = 0 switchtime = 45 / samplerate * 1000 -- 45 seconds to spawn protection switch -- make a variable here to pickup the maptime, so the current mapname can be displayed X milliseconds later maptime = levelTime end function et_Print(text) if text == "Setting Axis autospawn to Axis Main Bunker\n" then batteryspawnswitch = 1 end if text == "Setting Axis autospawn to West Bunker\n" then batteryspawnswitch = 0 end if text == "Intermission starts\n" then batteryspawnswitch = 0 end end