Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Phasor Anti-Aimbot Script v3.5]]--
- --[[Creators: Wizard & Skylace]]--
- --[[Converted for phasor v2 thanks to the help of AelitePrime]]--
- --[[Xfires: th3w1zard3, it300, and eliteprime14789x]]--
- --[[Websites: http://www.halopcservers.com & http://phasorscripts.wordpress.com/ ]]--
- --[[Thanks to others who helped test the script]]--
- max_score = 100 --Score needed before an 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 AimbotBans.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 = 4 --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 = {}
- function GetRequiredVersion()
- return 200
- end
- --[[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)
- return (not isSpawning[player] )
- end
- function OnScriptLoad(process, game, persistent)
- if game == "PC" then
- network_server_globals = 0x69B934
- else
- network_server_globals = 0x61FB64
- end
- for i = 0,15 do
- loc[i] = {}
- player_score[i] = 0
- end
- log_file = getprofilepath() .. "\\logs\\Antibot.log"
- registertimer(score_timeout * 1000, "ScoreTimeoutTimer", points_reduced)
- end
- function OnServerCommand(player, command, password)
- local response = nil
- t = tokenizecmdstring(command)
- count = #t
- if password == readstring(network_server_globals + 0x128) then
- if t[1] == "sv_getscore" then
- response = 0
- if rresolveplayer(t[2]) then
- sendconsoletext(player, tostring(player_score[rresolveplayer(t[2])]))
- else
- sendconsoletext(player, "Invalid Player!")
- end
- elseif t[1] == "sv_getscores" then
- resonse = 0
- sendconsoletext(player, "Name | Score")
- for i = 0,15 do
- if getplayer(i) then
- sendconsoletext(player, getname(i) .. " | " .. player_score[i])
- 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
- sendconsoletext(player, "Hey, you don't want to go below 75 trust me.")
- end
- else
- sendconsoletext(player, "Invalid Syntax! sv_scorelimit [number]")
- 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
- sendconsoletext(player, "Cannot set ban time with action as kick or notify!")
- end
- elseif t[2] == "ban" then
- if t[3] then
- default_ban_time = t[3]
- else
- sendconsoletext(player, "BAN SYNTAX = sv_aimbot_action ban [time(1m, 1d, 1m, or 1y)]")
- end
- else
- sendconsoletext(player, "Invalid action!")
- end
- else
- sendconsoletext(player, "Invalid Syntax! sv_aimbot_action [action(notify, ban, or kick)]")
- end
- end
- end
- return response
- end
- function OnPlayerJoin(player)
- snap_angle[player] = 0
- warning_table[player] = 0
- player_score[player] = 0
- end
- function OnPlayerLeave(player)
- 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 OnPlayerSpawn(player)
- camera_table[player] = nil
- watch_table[player] = nil
- snap_angle[player] = 0
- isSpawning[player] = true
- registertimer(500, "playerIsSpawning", player)
- end
- function OnPlayerSpawnEnd(player)
- camera_table[player] = nil
- watch_table[player] = nil
- snap_angle[player] = 0
- end
- function OnClientUpdate(player)
- local m_objectId = getplayerobjectid( player )
- local m_object = getobject( m_objectId )
- 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 = true
- if distance >= 10 then result = OnPlayerTeleport( player ) end
- if result == 0 or not result then
- movobjectcoords(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
- local value = ( snap_stop_angle - ( degrees_subtracted * ( ( distance or 0 ) / distance_variable ) ) )
- if angle < value and OnAimbotDetection(player) then
- for i = 0, 15 do
- if IsLookingAt(player, i) then
- TallyPlayer(player)
- break
- 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 OnPlayerTeleport( player )
- isSpawning[player] = true
- registertimer(600, "playerIsSpawning", player)
- return true
- end
- function playerIsSpawning(id, count, player)
- isSpawning[player] = false
- return false
- end
- function ScoreTimeoutTimer(id, count, score_depletion)
- for i = 0,15 do
- if player_score[i] and 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
- return true
- end
- function TallyPlayer(player)
- if getplayer(player) == nil then
- return
- end
- if getping(player) <= max_ping then
- 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 and not actionTaken[player] then
- if default_action == "kick" then
- svcmd("sv_crash " .. 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
- if logwarnings and actionTaken[player] == true then
- local name = getname(player)
- if not name then say("NAME IS NIL") end
- 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 line = "(Name: %s) (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 sayExcept(message, player)
- for i = 0, 15 do
- if i ~= player then
- privatesay(i, message)
- end
- end
- end
- function getping(player)
- local m_player = getplayer(player)
- if m_player then return readword(m_player + 0xDC) end
- end
- function IsLookingAt(player1, player2)
- if getplayer(player1) == nil or getplayer(player2) == nil then -- Check if player slots are in use
- return
- end
- local m_playerObjId1 = getplayerobjectid( player1 )
- local m_playerObjId2 = getplayerobjectid( player2 )
- if m_playerObjId1 == nil or m_playerObjId2 == nil then -- Checks if players are alive
- return
- end
- if same_team_detect and getteam( player1 ) == getteam( player2 ) then -- Checks if players are on the same team.
- return false
- end
- local m_object1 = getobject( m_playerObjId1 )
- local m_object2 = getobject( m_playerObjId2 )
- local camera_x = math.round( readfloat(m_object1 + 0x230) , 1)
- local camera_y = math.round( readfloat(m_object1 + 0x234) , 1)
- local camera_z = math.round( readfloat(m_object1 + 0x238) , 1)
- local location1_x = readfloat(m_object1 + 0x5C)
- local location1_y = readfloat(m_object1 + 0x60)
- local location1_z = checkState( readbyte(m_object1 + 0x2A7) , readfloat(m_object1 + 0x64) )
- local location2_x = readfloat(m_object2 + 0x5C)
- local location2_y = readfloat(m_object2 + 0x60)
- local location2_z = checkState( readbyte(m_object2 + 0x2A7) , readfloat(m_object2 + 0x64) )
- if location1_z == nil or location2_z == nil then
- return
- end
- local local_x = (location2_x - location1_x)
- local local_y = (location2_y - location1_y)
- local local_z = (location2_z - location1_z)
- local radius = math.sqrt( (local_x) ^ 2 + (local_y) ^ 2 + (local_z) ^ 2 )
- local point_x = math.round(1 / radius * local_x, 1)
- local point_y = math.round(1 / radius * local_y, 1)
- local point_z = math.round(1 / radius * local_z, 1)
- local isLookingAt = (camera_x == point_x and camera_y == point_y and camera_z == point_z)
- return isLookingAt
- end
- function checkState(state, location_z)
- if state == 2 then
- return location_z + 0.6
- elseif state == 3 then
- return location_z + 0.3
- end
- return nil
- end
- function sendresponse(message, player)
- if player then
- sendconsoletext(player, message)
- else
- hprintf(message)
- end
- end
- function math.round(number, place)
- return math.floor(number * ( 10 ^ (place or 0) ) + 0.5) / ( 10 ^ (place or 0) )
- end
- function WriteLog(filename, value)
- local file = io.open(filename, "a")
- if file then
- file:write( string.format("%s\t%s\n", os.date("!%m/%d/%Y %H:%M:%S"), tostring(value) ) )
- file:close()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement