Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Phasor Anti-Aimbot Script v3.5]]--
- --[[Creators: Wizard & Skylace]]--
- --[[Xfires: th3w1zard3, and it300]]--
- --[[Website: http://bud.boards.net ]]--
- --[[Thanks to others who helped test the script]]--
- max_score = 100 --Score needed before action is taken on the player.(Recomended it to be between 100 and 200)
- score_timeout = 2.5 --Time needed for a player to loose a specified amount of points. (In seconds)
- points_reduced = 1 --Points that will be lost when the timeout has been reached.
- max_ping = 500 --Max Ping the server will look at to see if a player is aimbotting.
- warnings_needed = 1 --warnings needed before an action is taken.
- default_action = "kick" --Action the server will take if a player is cought. (Use notify, kick, or ban)
- default_ban_time = 0 --How long the player will be banned. 0 = indefinite.
- logwarnings = true --Logs snaps and warnings to Antibot.log.
- notify_player = false --Should the player be notified that they have been suspected of aimbotting.
- notify_admins = true --Should admins be notified that a player has been suspected of aimbotting.
- notify_server = true --Should the server be notified that a player has been suspected of aimbotting. (Means everyone)
- same_team_detect = true --Should it check if they are on he same team? (Recomended)
- snap_max_angle = 180 --Max snap angle detectable. (180 Recomended)
- snap_min_angle = 5 --Min snap angle detectable. (5 Recomended)
- snap_stop_angle = 3 --I recomend anywhere from 2.5 to 4.5
- degrees_subtracted = 0.015 --Degrees removed after the specified distance_variable.
- distance_variable = 4.5 --Distance needed to subtract the amount of degrees above.
- --[[This is the table of what degree snaps will give the amount of score. It is used like so...
- score_snap_angle = {{Degree, Degree, Score Added},
- {50, 90, 50},
- {90, 120, 60}
- }
- ]]--
- score_snap_angle = {
- {4, 8, 10},
- {9, 14, 15},
- {15, 20, 17},
- {21, 26, 19},
- {25, 32, 21},
- {33, 38, 23},
- {39, 44, 25},
- {45, 50, 27},
- {51, 56, 29},
- {57, 62, 31},
- {63, 68, 33},
- {69, 74, 33},
- {75, 80, 27},
- {81, 86, 25},
- {85, 92, 23},
- {92, 98, 21},
- {99, 180, 19}
- }
- --[[Do not change anything below this point]]--
- camera_table = {}
- watch_table = {}
- snap_table = {}
- warning_table = {}
- snap_angle = {}
- player_score = {}
- isSpawning = {}
- actionTaken = {}
- loc = {}
- --[[Called when a player has been suspected of aimbotting. This is called before the player has been tallied for snapping.
- The return value determines if the player should be tallied. Returning true tallies the player, returning false doesn't]]--
- function OnAimbotDetection(player)
- if isSpawning[player] then
- return false
- end
- return true
- end
- function GetRequiredVersion()
- return 10057
- end
- function OnScriptLoad(process)
- hprintf("Antibot Loaded")
- for i = 0,15 do
- loc[i] = {}
- end
- profile_path = getprofilepath()
- log_file = profile_path .. "\\logs\\Antibot.log"
- registertimer(score_timeout * 1000, "ScoreTimeoutTimer", points_reduced)
- end
- function ScoreTimeoutTimer(id, count, score_depletion)
- for i = 0,15 do
- if player_score[i] then
- if player_score[i] ~= 0 then
- player_score[i] = player_score[i] - score_depletion
- if player_score[i] <= 0 then
- player_score[i] = 0
- end
- end
- end
- end
- return 1
- end
- function OnScriptUnload()
- end
- function OnNewGame(map)
- end
- function OnGameEnd(mode)
- end
- function OnServerChat(player, mode, msg)
- return 1
- end
- function OnServerCommand(player, command)
- local response = 1
- local count = getcmdtokencount(command)
- local cmd = getcmdtoken(command, 0)
- local hash = gethash(player)
- t = {}
- for i=1,count do
- local word = getcmdtoken(command, i - 1)
- word = string.lower(word)
- table.insert(t, word)
- end
- if t[1] == "sv_getscore" then
- response = 0
- if rresolveplayer(t[2]) then
- hprintf(tostring(player_score[rresolveplayer(t[2])]), player)
- else
- hprintf("Invalid Player!", player)
- end
- elseif t[1] == "sv_getscores" then
- resonse = 0
- hprintf("Name | Score", player)
- for i = 0,15 do
- if getplayer(i) then
- hprintf(getname(i) .. " | " .. player_score[i], player)
- end
- end
- elseif t[1] == "sv_scorelimit" then
- response = false
- if tonumber(t[2]) then
- if t[2] > 75 then
- max_score = (t[2])
- else
- hprintf("Hey, you don't want to go below 75 trust me.", player)
- end
- else
- hprintf("Invalid Syntax! sv_scorelimit [number]", player)
- end
- elseif t[1] == "sv_aimbot_action" or cmd == "sv_aimbot_ban" then
- response = false
- if t[2] then
- if t[2] == "notify" or t[2] == "kick" then
- if not t[3] then
- default_action = t[2]
- else
- hprintf("Cannot set ban time with action as kick or notify!", player)
- end
- elseif t[2] == "ban" then
- if t[3] then
- default_ban_time = t[3]
- else
- hprintf("BAN SYNTAX = sv_aimbot_action ban [time(1m, 1d, 1m, or 1y)]", player)
- end
- else
- hprintf("Invalid action!", player)
- end
- else
- hprintf("Invalid Syntax! sv_aimbot_action [action(notify, ban, or kick)]", player)
- end
- end
- return response
- end
- function OnTeamDecision(team)
- return team
- end
- function OnPlayerJoin(player, team)
- snap_angle[player] = 0
- warning_table[player] = 0
- player_score[player] = 0
- end
- function OnPlayerLeave(player, team)
- camera_table[player] = nil
- watch_table[player] = nil
- snap_angle[player] = nil
- warning_table[player] = nil
- player_score[player] = 0
- actionTaken[player] = nil
- end
- function OnPlayerKill(killer, victim, mode)
- camera_table[victim] = nil
- watch_table[victim] = nil
- snap_angle[victim] = 0
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, object)
- camera_table[player] = nil
- watch_table[player] = nil
- snap_angle[player] = 0
- isSpawning[player] = registertimer(500, "playerIsSpawning", player)
- end
- function OnPlayerSpawnEnd(player, object)
- camera_table[player] = nil
- watch_table[player] = nil
- snap_angle[player] = 0
- end
- function playerIsSpawning(id, count, player)
- isSpawning[player] = nil
- return 0
- end
- function OnTeamChange(relevant, player, team, change)
- return 1
- end
- function OnClientUpdate(player, object)
- local m_player = getplayer(player)
- if m_player == nil then
- return
- end
- local m_objectId = readdword(m_player, 0x34)
- local m_object = getobject(m_objectId)
- if m_object == nil then
- return
- end
- local x,y,z = getobjectcoords(m_objectId)
- local distance
- if x ~= loc[player][1] or y ~= loc[player][2] or z ~= loc[player][3] then
- if loc[player][1] == nil then
- loc[player][1] = x
- loc[player][2] = y
- loc[player][3] = z
- elseif m_object then
- distance = math.sqrt((loc[player][1] - x)^2 + (loc[player][2] - y)^2 + (loc[player][3] - z)^2)
- local result = OnPositionUpdate(player, m_objectId, x, y, z, loc[player][1], loc[player][2], loc[player][3], distance)
- if distance >= 10 then
- result = OnPlayerTeleport(player, m_objectId, x, y, z, loc[player][1], loc[player][2], loc[player][3], distance)
- end
- if result == 0 or not result then
- movobjcoords(m_objectId, loc[player][1], loc[player][2], loc[player][3])
- else
- loc[player][1] = x
- loc[player][2] = y
- loc[player][3] = z
- end
- end
- end
- local camera_x = readfloat(m_object, 0x230)
- local camera_y = readfloat(m_object, 0x234)
- local camera_z = readfloat(m_object, 0x238)
- if camera_table[player] == nil then
- camera_table[player] = {camera_x, camera_y, camera_z}
- return
- end
- local last_camera_x = camera_table[player][1]
- local last_camera_y = camera_table[player][2]
- local last_camera_z = camera_table[player][3]
- camera_table[player] = {camera_x, camera_y, camera_z}
- if last_camera_x == 0 and
- last_camera_y == 0 and
- last_camera_z == 0 then
- return
- end
- local movement = math.sqrt(
- (camera_x - last_camera_x) ^ 2 +
- (camera_y - last_camera_y) ^ 2 +
- (camera_z - last_camera_z) ^ 2)
- local angle = math.acos((2 - movement ^ 2) / 2)
- angle = angle * 180 / math.pi
- if watch_table[player] ~= nil then
- watch_table[player] = nil
- if angle < (snap_stop_angle-(degrees_subtracted*((distance or 0)/distance_variable))) then
- for i = 0, 15 do
- if IsLookingAt(player, i) then
- if OnAimbotDetection(player) then
- TallyPlayer(player)
- break
- end
- return
- end
- end
- end
- return
- end
- if angle > snap_min_angle and angle < snap_max_angle then
- watch_table[player] = true
- snap_angle[player] = angle
- end
- end
- function OnPositionUpdate(player, m_objectId, x, y, z, x2, y2, z2, distance)
- return true
- end
- function OnPlayerTeleport(player, m_objectId, x, y, z, x2, y2, z2, distance)
- isSpawning[player] = registertimer(600, "playerIsSpawning", player)
- return true
- end
- function OnObjectInteraction(player, object, tag_type, tag_name)
- return 1
- end
- function OnWeaponReload(player, weapon)
- return 1
- end
- function OnVehicleEntry(relevant, player, vehicle, tag_name, seat)
- return 1
- end
- function OnVehicleEject(player, forced)
- return 1
- end
- function OnDamageLookup(receiver, causer, tag_data, tag_name)
- end
- function OnWeaponAssignment(player, object, count, tag_name)
- return 0
- end
- function OnObjectCreation(object, owner, tag_name)
- end
- function TallyPlayer(player)
- local player_ping = getping(player)
- if player_ping <= max_ping then
- if getplayer(player) == nil then
- return
- end
- for i = 1,#score_snap_angle do
- if snap_angle[player] >= score_snap_angle[i][1] and snap_angle[player] <= score_snap_angle[i][2] then
- player_score[player] = player_score[player] + score_snap_angle[i][3]
- hprintf(tostring(getname(player)) .. " now has added " .. tostring(score_snap_angle[i][3]))
- break
- end
- end
- if player_score[player] >= max_score then
- if warning_table[player] == nil then
- warning_table[player] = 0
- end
- warning_table[player] = warning_table[player] + 1
- if warning_table[player] >= warnings_needed then
- if not actionTaken[player] then
- if default_action == "kick" then
- svcmd("sv_kick " .. resolveplayer(player))
- if notify_player then
- privatesay(player, "You have been kicked for aimbotting.")
- end
- if notify_admins then
- for i = 0, 15 do
- if getplayer(i) ~= nil and isadmin(i) then
- privatesay(i, getname(player) .. " was kicked for aimbotting.")
- end
- end
- end
- if notify_server then
- for i = 0, 15 do
- if getplayer(i) ~= nil then
- if not isadmin(i) then
- privatesay(i, getname(player) .. " was kicked for aimbotting.")
- end
- end
- end
- end
- elseif default_action == "notify" then
- if notify_player then
- privatesay(player, "You have been suspected of aimbotting.")
- end
- if notify_admins then
- for i = 0, 15 do
- if getplayer(i) ~= nil and isadmin(i) then
- privatesay(i, getname(player) .. " is suspected of aimbotting.")
- end
- end
- end
- if notify_server then
- for i = 0, 15 do
- if getplayer(i) ~= nil then
- if not isadmin(i) then
- privatesay(i, getname(player) .. " is suspected of aimbotting.")
- end
- end
- end
- end
- elseif default_action == "ban" then
- svcmd("sv_ban " .. resolveplayer(player) .. " " .. default_ban_time)
- if notify_player then
- privatesay(player, "You have been banned for aimbotting.")
- end
- if notify_admins then
- for i = 0, 15 do
- if getplayer(i) ~= nil and isadmin(i) then
- privatesay(i, getname(player) .. " was banned for aimbotting.")
- end
- end
- end
- if notify_server then
- for i = 0, 15 do
- if getplayer(i) ~= nil then
- if not isadmin(i) then
- privatesay(i, getname(player) .. " was banned for aimbotting.")
- end
- end
- end
- end
- end
- actionTaken[player] = true
- end
- end
- end
- if logwarnings and actionTaken[player] == true then
- local hash = gethash(player)
- if not hash then say("HASH IS NIL") end
- local ip = getip(player)
- if not ip then say("IP IS NIL") end
- local ping = getping(player)
- if not ping then say("PING IS NIL") end
- local name = getname(player)
- if not name then say("NAME IS NIL") end
- local line = "%s (%s) was banned. (Hash: %s) (IP: %s) (ping: %s). Score: %s Action: %s"
- if not log_file then say("LOGFILE IS NIL") end
- line = string.format(line, name, hash, ip, ping, player_score[player], default_action)
- WriteLog(log_file, line)
- else
- end
- end
- end
- function WriteLog(filename, value)
- local file = io.open(filename, "a")
- if file then
- local timestamp = os.date("!%m/%d/%Y %H:%M:%S")
- local line = string.format("%s\t%s\n", timestamp, tostring(value))
- file:write(line)
- file:close()
- else
- hprintf("LOG FILE IS NIL")
- end
- end
- function getping(player)
- local m_player = getplayer(player)
- if not m_player then
- return
- end
- local ping = readword(m_player, 0xDC)
- return ping
- end
- function IsLookingAt(player1, player2)
- local m_player1 = getplayer(player1)
- local m_player2 = getplayer(player2)
- if same_team_detect then
- local team1 = readbyte(m_player1, 0x20)
- local team2 = readbyte(m_player2, 0x20)
- if team1 == team2 then
- return false
- end
- end
- if m_player1 == nil or m_player2 == nil then
- return
- end
- local object1 = readdword(m_player1, 0x34)
- local object2 = readdword(m_player2, 0x34)
- local m_object1 = getobject(object1)
- local m_object2 = getobject(object2)
- if m_object1 == nil or m_object2 == nil then
- return
- end
- local camera_x = readfloat(m_object1, 0x230)
- local camera_y = readfloat(m_object1, 0x234)
- local camera_z = readfloat(m_object1, 0x238)
- local location1_x = readfloat(m_object1, 0x5C)
- local location1_y = readfloat(m_object1, 0x60)
- local location1_z = readfloat(m_object1, 0x64)
- local location2_x = readfloat(m_object2, 0x5C)
- local location2_y = readfloat(m_object2, 0x60)
- local location2_z = readfloat(m_object2, 0x64)
- local state1 = readbyte(m_object1, 0x2A7)
- local state2 = readbyte(m_object2, 0x2A7)
- if state1 == 2 then
- location1_z = location1_z + 0.6
- elseif state1 == 3 then
- location1_z = location1_z + 0.3
- else
- return
- end
- if state2 == 2 then
- location2_z = location2_z + 0.6
- elseif state2 == 3 then
- location2_z = location2_z + 0.3
- else
- return
- end
- local radius = math.sqrt(
- (location2_x - location1_x) ^ 2 +
- (location2_y - location1_y) ^ 2 +
- (location2_z - location1_z) ^ 2)
- local local_x = location2_x - location1_x
- local local_y = location2_y - location1_y
- local local_z = location2_z - location1_z
- local point_x = 1 / radius * local_x
- local point_y = 1 / radius * local_y
- local point_z = 1 / radius * local_z
- if math.round(camera_x, 1) == math.round(point_x, 1) and
- math.round(camera_y, 1) == math.round(point_y, 1) and
- math.round(camera_z, 1) == math.round(point_z, 1) then
- return true
- end
- return false
- end
- function getip(player)
- local m_player = getplayer(player)
- local IP_Address = ""
- if m_player then
- local machine_struct = getmachinestruct(player)
- local machine_network = readdword(readdword(machine_struct, 0x0), 0x0)
- local a = readbyte(machine_network, 0)
- local b = readbyte(machine_network, 1)
- local c = readbyte(machine_network, 2)
- local d = readbyte(machine_network, 3)
- if b then
- IP_Address = string.format("%i.%i.%i.%i", a, b, c, d)
- end
- end
- return IP_Address
- end
- function math.round(number, place)
- local mult = 10 ^ (place or 0)
- return math.floor(number * mult + 0.5) / mult
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement