Created
May 16, 2016 17:49
-
-
Save Lexicality/24829c54ced256ab4c92ebbe21950001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- JetBot [v1.1] | |
-- by JetBoom | |
-- Clientside aimbot and esp for GMod10. This is a demonstration | |
-- of how easy you can make client-side things for naughty purposes. It should | |
-- be fixed soon enough by CRC checking. [ On most servers, anyway ;) ] | |
-- All concommands begin with aimbot_ or esp_ | |
-- To use the aimbot, bind a key or mouse button to "+aimbot_scan". Hold the key and | |
-- move your mouse over a player or whatever you want to hit (make sure the correct | |
-- playeronly, enemyonly flags are used) and it will snap to that thing until you let go. | |
-- These are the default settings. Most are saved when you leave a server. | |
-- Aimbot on/off. | |
AIMBOT_ON = false | |
-- Only target players. | |
AIMBOT_PLAYERSONLY = true | |
-- Only target people who aren't on your team. | |
AIMBOT_ENEMYSONLY = false | |
-- ESP on/off. | |
ESP_ON = false | |
-- Default offset to use. This shoots people in the chest area. | |
AIMBOT_OFFSET = Vector(0,0,45) | |
-- Aim for the head when target is a player. (ignore offsets) | |
AIMBOT_HEADSHOTS = true | |
-- Suicide health threshold. This is the health needed before you suicide. | |
SUICIDE_HEALTH = 0 | |
-- I've tested it and this seems to be the best I can get. Your ping also plays | |
-- a factor in lag compensation calculations so you shouldn't have to change this. | |
AIMBOT_LAGCOMPENSATION = 0.0025 | |
OFFSETPRESETS = {} | |
--OFFSETPRESETS["headshot"] = 55 -- I need to add in some side offsets because the head is hunched. | |
OFFSETPRESETS["chest"] = 45 | |
OFFSETPRESETS["none"] = 0 | |
-- | | | |
-- \|/ Core code \|/ | |
MySelf = LocalPlayer() | |
AIMBOT_SCANNING = false | |
AIMBOT_HEADOFFSET = Vector(0,0,58.5) | |
AIMBOT_HEADOFFSET_CROUCHING = Vector(0,0,34) | |
surface.CreateFont( "arial", 12, 400, true, false, "AimBotSmall" ) | |
surface.CreateFont( "coolvetica", 24, 500, true, false, "AimBotBig" ) | |
AIMBOT_TARGET = nil | |
COLOR_FRIENDLY = Color(0, 255, 0, 255) | |
COLOR_ENEMY = Color(255, 0, 0, 255) | |
COLOR_DEAD = Color(0, 0, 0, 255) | |
COLOR_TRACKING = Color(255, 0, 255, 255) | |
CreateClientConVar("_esp", 1, true, false) | |
CreateClientConVar("_aimbot", 1, true, false) | |
CreateClientConVar("_aimbot_headshots", 1, true, false) | |
CreateClientConVar("_aimbot_enemysonly", 0, true, false) | |
CreateClientConVar("_aimbot_playersonly", 1, true, false) | |
CreateClientConVar("_aimbot_lagcompensation", AIMBOT_LAGCOMPENSATION, true, false) | |
CreateClientConVar("_aimbot_suicidehealth", SUICIDE_HEALTH, true, false) | |
CreateClientConVar("_aimbot_offset", AIMBOT_OFFSET.z, true, false) | |
ESP_ON = util.tobool(GetConVarNumber("_esp")) | |
AIMBOT_ON = util.tobool(GetConVarNumber("_aimbot")) | |
AIMBOT_HEADSHOTS = util.tobool(GetConVarNumber("_aimbot_headshots")) | |
AIMBOT_ENEMYSONLY = util.tobool(GetConVarNumber("_aimbot_enemysonly")) | |
AIMBOT_PLAYERSONLY = util.tobool(GetConVarNumber("_aimbot_playersonly")) | |
AIMBOT_LAGCOMPENSATION = GetConVarNumber("_aimbot_lagcompensation") | |
SUICIDE_HEALTH = GetConVarNumber("_aimbot_suicidehealth") | |
AIMBOT_OFFSET = Vector(0,0,GetConVarNumber("_aimbot_offset")) | |
function ESP_On(sender, command, arguments) | |
AddBotNotify( "ESP on!!", NOTIFY_HINT, 6 ) | |
ESP_ON = true | |
MySelf:ConCommand("_esp 1\n") | |
end | |
concommand.Add("esp_on", ESP_On) | |
function ESP_Off(sender, command, arguments) | |
AddBotNotify( "ESP off!!", NOTIFY_HINT, 6 ) | |
ESP_ON = false | |
MySelf:ConCommand("_esp 0\n") | |
end | |
concommand.Add("esp_off", ESP_Off) | |
function AimBot_Off(sender, command, arguments) | |
AddBotNotify( "Aimbot off!!", NOTIFY_HINT, 6 ) | |
AIMBOT_ON = false | |
AIMBOT_SCANNING = false | |
MySelf:ConCommand("_aimbot 0\n") | |
end | |
concommand.Add("aimbot_off", AimBot_Off) | |
function AimBot_On(sender, command, arguments) | |
AddBotNotify( "Aimbot on!!", NOTIFY_HINT, 6 ) | |
AIMBOT_ON = true | |
MySelf:ConCommand("_aimbot 1\n") | |
end | |
concommand.Add("aimbot_on", AimBot_On) | |
function AimBot_HeadShotsOff(sender, command, arguments) | |
AddBotNotify("Headshots off!!", NOTIFY_HINT, 6) | |
AIMBOT_HEADSHOTS = false | |
MySelf:ConCommand("_aimbot_headshots 0\n") | |
end | |
concommand.Add("aimbot_headshots_off", AimBot_HeadShotsOff) | |
function AimBot_HeadShotsOn(sender, command, arguments) | |
AddBotNotify("Headshots on!!", NOTIFY_HINT, 6) | |
AIMBOT_HEADSHOTS = true | |
MySelf:ConCommand("_aimbot_headshots 1\n") | |
end | |
concommand.Add("aimbot_headshots_on", AimBot_HeadShotsOn) | |
function AimBot_EnemysOnly_On(sender, command, arguments) | |
AddBotNotify( "Targeting enemys only!!", NOTIFY_HINT, 6 ) | |
AIMBOT_ENEMYSONLY = true | |
MySelf:ConCommand("_aimbot_enemysonly 1\n") | |
end | |
concommand.Add("aimbot_enemysonly_on", AimBot_EnemysOnly_On) | |
function AimBot_EnemysOnly_Off(sender, command, arguments) | |
AddBotNotify( "Targeting friendlies and enemies!!", NOTIFY_HINT, 6 ) | |
AIMBOT_ENEMYSONLY = false | |
MySelf:ConCommand("_aimbot_enemysonly 0\n") | |
end | |
concommand.Add("aimbot_enemysonly_off", AimBot_EnemysOnly_Off) | |
function AimBot_PlayersOnly_On(sender, command, arguments) | |
AddBotNotify( "Targeting players!!", NOTIFY_HINT, 6 ) | |
AIMBOT_PLAYERSONLY = true | |
MySelf:ConCommand("_aimbot_playersonly 1\n") | |
end | |
concommand.Add("aimbot_playersonly_on", AimBot_PlayersOnly_On) | |
function AimBot_PlayersOnly_Off(sender, command, arguments) | |
AddBotNotify( "Targeting everything!!", NOTIFY_HINT, 6 ) | |
AIMBOT_PLAYERSONLY = false | |
MySelf:ConCommand("_aimbot_playersonly 0\n") | |
end | |
concommand.Add("aimbot_playersonly_off", AimBot_PlayersOnly_Off) | |
function AimBot_SetLagCompensation(sender, command, arguments) | |
if arguments[1] == nil then AddBotNotify( "Lag Compensation is currently "..AIMBOT_LAGCOMPENSATION.."!!", NOTIFY_HINT, 6 ) return end | |
if tonumber(arguments[1]) == nil then | |
AddBotNotify( "Not a number!", NOTIFY_ERROR, 6 ) | |
return | |
end | |
AIMBOT_LAGCOMPENSATION = math.Clamp(tonumber(arguments[1]), 0, 2) | |
AddBotNotify( "Lag Compensation changed to "..AIMBOT_LAGCOMPENSATION.."!!", NOTIFY_HINT, 6 ) | |
MySelf:ConCommand("_aimbot_lagcompensation "..AIMBOT_LAGCOMPENSATION.."\n") | |
end | |
concommand.Add("aimbot_lagcompensation", AimBot_SetLagCompensation) | |
function AimBot_SetSuicideHealth(sender, command, arguments) | |
if arguments[1] == nil then AddBotNotify( "Suicide health is currently "..SUICIDE_HEALTH.."!!", NOTIFY_HINT, 6 ) return end | |
if tonumber(arguments[1]) == nil then | |
AddBotNotify( "Not a number!", NOTIFY_ERROR, 6 ) | |
return | |
end | |
SUICIDE_HEALTH = tonumber(arguments[1]) | |
AddBotNotify("Suicide health changed to "..SUICIDE_HEALTH.."!!", NOTIFY_HINT, 6) | |
MySelf:ConCommand("_aimbot_suicidehealth "..SUICIDE_HEALTH.."\n") | |
end | |
concommand.Add("aimbot_suicidehealth", AimBot_SetSuicideHealth) | |
function AimBot_SetOffset(sender, command, arguments) | |
if arguments[1] == nil then AddBotNotify( "Offset is currently "..AIMBOT_OFFSET.z.."!!", NOTIFY_HINT, 6 ) return end | |
if tonumber(arguments[1]) == nil then | |
if OFFSETPRESETS[arguments[1] ] then | |
AIMBOT_OFFSET = Vector(0,0, OFFSETPRESETS[arguments[1] ]) | |
AddBotNotify( "Offset changed to "..AIMBOT_OFFSET.z.."!!", NOTIFY_HINT, 6 ) | |
return | |
else | |
AddBotNotify( "Offset is not a number!", NOTIFY_ERROR, 6 ) | |
return | |
end | |
end | |
AIMBOT_OFFSET = Vector(0,0, math.Clamp(tonumber(arguments[1]), -512, 512)) | |
AddBotNotify("Offset changed to "..AIMBOT_OFFSET.z.."!!", NOTIFY_HINT, 6) | |
MySelf:ConCommand("_aimbot_offset "..AIMBOT_OFFSET.z.."\n") | |
end | |
concommand.Add("aimbot_offset", AimBot_SetOffset) | |
function AimBot_ScanOn(sender, command, arguments) | |
AIMBOT_SCANNING = true | |
end | |
concommand.Add("+aimbot_scan", AimBot_ScanOn) | |
function AimBot_ScanOff(sender, command, arguments) | |
AIMBOT_SCANNING = false | |
AIMBOT_TARGET = nil | |
end | |
concommand.Add("-aimbot_scan", AimBot_ScanOff) | |
function GetTargetPos(ent) | |
if ent:IsPlayer() then | |
if AIMBOT_HEADSHOTS then | |
return ent:GetAttachment(1).Pos + ent:GetAngles():Forward() * -4 | |
else | |
if ent:Crouching() then | |
return ent:GetPos() + (AIMBOT_OFFSET * 0.586) | |
else | |
return ent:GetPos() + AIMBOT_OFFSET | |
end | |
end | |
else | |
return ent:GetPos() + AIMBOT_OFFSET | |
end | |
end | |
LAST_SUICIDE = CurTime() | |
function DoAimBot() | |
if ESP_ON then | |
draw.SimpleText("ESP", "AimBotBig", ScrW() * 0.5, ScrH() * 0.01, COLOR_ENEMY, TEXT_ALIGN_CENTER) | |
for _, pl in pairs(player.GetAll()) do | |
if pl == MySelf then | |
-- DO NOTHING | |
elseif pl:Alive() then | |
local pos = GetTargetPos(pl) | |
local mypos = MySelf:GetPos() | |
-- local size = math.Clamp(64 - mypos:Distance(pos) * 0.1, 18, 64) | |
local size = ScrW() * 0.02 | |
pos = pos:ToScreen() | |
if AIMBOT_TARGET and pl == AIMBOT_TARGET then | |
-- Nothing | |
elseif pl:Team() == MySelf:Team() then | |
surface.SetDrawColor(0, 255, 0, 255) | |
surface.DrawLine( pos.x - size, pos.y, pos.x + size, pos.y ) | |
surface.DrawLine( pos.x, pos.y - size, pos.x, pos.y + size) | |
draw.SimpleText(pl:Name(), "AimBotBig", pos.x, pos.y + size + 10, COLOR_FRIENDLY, TEXT_ALIGN_CENTER) | |
draw.SimpleText("HP: "..pl:Health(), "AimBotSmall", pos.x, pos.y + size + 30, COLOR_ENEMY, TEXT_ALIGN_LEFT) | |
draw.SimpleText("Dist: "..math.floor(pl:GetPos():Distance(mypos)), "AimBotSmall", pos.x, pos.y + size + 42, COLOR_ENEMY, TEXT_ALIGN_LEFT) | |
else | |
surface.SetDrawColor(255, 0, 0, 255) | |
surface.DrawLine( pos.x - size, pos.y, pos.x + size, pos.y ) | |
surface.DrawLine( pos.x, pos.y - size, pos.x, pos.y + size) | |
draw.SimpleText(pl:Name(), "AimBotBig", pos.x, pos.y + size + 10, COLOR_ENEMY, TEXT_ALIGN_CENTER) | |
draw.SimpleText("HP: "..pl:Health(), "AimBotSmall", pos.x, pos.y + size + 30, COLOR_FRIENDLY, TEXT_ALIGN_LEFT) | |
draw.SimpleText("Dist: "..math.floor(pl:GetPos():Distance(mypos)), "AimBotSmall", pos.x, pos.y + size + 42, COLOR_FRIENDLY, TEXT_ALIGN_LEFT) | |
end | |
else | |
local pos = GetTargetPos(pl) | |
local mypos = MySelf:GetPos() | |
local size = math.Clamp(64 - mypos:Distance(pos) * 0.1, 18, 64) | |
pos = pos:ToScreen() | |
surface.SetDrawColor(0, 0, 0, 255) | |
surface.DrawLine( pos.x - size, pos.y, pos.x + size, pos.y ) | |
surface.DrawLine( pos.x, pos.y - size, pos.x, pos.y + size) | |
draw.SimpleText(pl:Name(), "AimBotBig", pos.x, pos.y + size + 10, COLOR_DEAD, TEXT_ALIGN_CENTER) | |
draw.SimpleText("** DEAD **", "AimBotSmall", pos.x, pos.y + size + 30, COLOR_DEAD, TEXT_ALIGN_CENTER) | |
draw.SimpleText("Dist: "..math.floor(pl:GetPos():Distance(mypos)), "AimBotSmall", pos.x, pos.y + size + 42, COLOR_DEAD, TEXT_ALIGN_LEFT) | |
end | |
end | |
end | |
if not MySelf:Alive() then return end | |
if MySelf:Health() <= SUICIDE_HEALTH then | |
if CurTime() > LAST_SUICIDE + 0.5 and MySelf:Health() > 0 then | |
MySelf:ConCommand("kill\n") | |
AddBotNotify( "Committing Suicide", NOTIFY_ERROR, 6 ) | |
LAST_SUICIDE = CurTime() | |
end | |
end | |
if AIMBOT_ON then | |
if AIMBOT_TARGET and AIMBOT_TARGET ~= nil and AIMBOT_TARGET:IsValid() then | |
local wpos = GetTargetPos(AIMBOT_TARGET) | |
local pos = wpos:ToScreen() | |
local size = ScrW() * 0.018 | |
if AIMBOT_LAGCOMPENSATION > 0 then | |
local velocity = AIMBOT_TARGET:GetVelocity() or Vector(0,0,0) | |
MySelf:SetEyeAngles(((wpos + velocity * (AIMBOT_LAGCOMPENSATION * MySelf:Ping())) - MySelf:GetShootPos()):Angle()) | |
local ppos = ((wpos + velocity * (AIMBOT_LAGCOMPENSATION * MySelf:Ping()))):ToScreen() | |
surface.SetDrawColor(255, 255, 0, 255) | |
surface.DrawLine( ppos.x - size, ppos.y, ppos.x + size, ppos.y ) | |
surface.DrawLine( ppos.x, ppos.y - size, ppos.x, ppos.y + size) | |
else | |
MySelf:SetEyeAngles((wpos - MySelf:GetShootPos()):Angle()) | |
end | |
surface.SetDrawColor(255, 0, 255, 255) | |
surface.DrawLine( pos.x - size, pos.y, pos.x + size, pos.y ) | |
surface.DrawLine( pos.x, pos.y - size, pos.x, pos.y + size) | |
if AIMBOT_TARGET:IsPlayer() then | |
if AIMBOT_TARGET:Alive() then | |
draw.SimpleText(AIMBOT_TARGET:Name(), "AimBotBig", pos.x, pos.y + size + 10, COLOR_TRACKING, TEXT_ALIGN_CENTER) | |
draw.SimpleText("HP: "..AIMBOT_TARGET:Health(), "AimBotSmall", pos.x, pos.y + size + 30, COLOR_TRACKING, TEXT_ALIGN_LEFT) | |
draw.SimpleText("Dist: "..math.floor(AIMBOT_TARGET:GetPos():Distance(MySelf:GetPos())), "AimBotSmall", pos.x, pos.y + size + 42, COLOR_TRACKING, TEXT_ALIGN_LEFT) | |
else | |
AddBotNotify("pwned "..AIMBOT_TARGET:Name(), NOTIFY_CLEANUP, 3) | |
surface.PlaySound("buttons/blip1.wav") | |
AIMBOT_TARGET = nil | |
end | |
else | |
draw.SimpleText(tostring(AIMBOT_TARGET), "AimBotBig", pos.x, pos.y + size + 10, COLOR_TRACKING, TEXT_ALIGN_CENTER) | |
draw.SimpleText("Dist: "..math.floor(AIMBOT_TARGET:GetPos():Distance(MySelf:GetPos())), "AimBotSmall", pos.x, pos.y + size + 30, COLOR_TRACKING, TEXT_ALIGN_LEFT) | |
end | |
else | |
if AIMBOT_SCANNING then | |
draw.SimpleText("Scanning...", "AimBotBig", ScrW() * 0.5, ScrH() * 0.6, COLOR_ENEMY, TEXT_ALIGN_CENTER) | |
local tr = utilx.GetPlayerTrace(MySelf, MySelf:GetCursorAimVector()) | |
local trace = util.TraceLine(tr) | |
if trace.Hit and trace.HitNonWorld then | |
local entity = trace.Entity | |
if AIMBOT_PLAYERSONLY then | |
if entity:IsValid() and entity:GetPos() then | |
if entity:IsPlayer() then | |
if entity:Team() ~= MySelf:Team() or not AIMBOT_ENEMYSONLY then | |
AIMBOT_TARGET = entity | |
AIMBOT_SCANNING = false | |
end | |
end | |
end | |
else | |
if entity:IsValid() and entity:GetPos() then | |
if entity:IsPlayer() then | |
if entity:Team() ~= MySelf:Team() or not AIMBOT_ENEMYSONLY then | |
AIMBOT_TARGET = entity | |
AIMBOT_SCANNING = false | |
end | |
else | |
AIMBOT_TARGET = entity | |
AIMBOT_SCANNING = false | |
end | |
end | |
end | |
end | |
else | |
AIMBOT_TARGET = nil | |
end | |
end | |
end | |
end | |
hook.Add("HUDPaint", "AIMBOT", DoAimBot) | |
NOTIFY_GENERIC = 0 | |
NOTIFY_ERROR = 1 | |
NOTIFY_UNDO = 2 | |
NOTIFY_HINT = 3 | |
NOTIFY_CLEANUP = 4 | |
if NoticeMaterial == nil then | |
NoticeMaterial = {} | |
end | |
NoticeMaterial[ NOTIFY_GENERIC ] = surface.GetTextureID( "vgui/notices/generic" ) | |
NoticeMaterial[ NOTIFY_ERROR ] = surface.GetTextureID( "vgui/notices/error" ) | |
NoticeMaterial[ NOTIFY_UNDO ] = surface.GetTextureID( "vgui/notices/undo" ) | |
NoticeMaterial[ NOTIFY_HINT ] = surface.GetTextureID( "vgui/notices/hint" ) | |
NoticeMaterial[ NOTIFY_CLEANUP ] = surface.GetTextureID( "vgui/notices/cleanup" ) | |
HUDNote_c = 0 | |
HUDNote_i = 1 | |
HUDNotes = {} | |
function AddBotNotify( str, type, length ) | |
local tab = {} | |
tab.text = str | |
tab.recv = CurTime() | |
tab.len = length | |
tab.velx = -5 | |
tab.vely = 0 | |
tab.x = ScrW() + 200 | |
tab.y = ScrH() | |
tab.a = 255 | |
tab.type = type | |
table.insert( HUDNotes, tab ) | |
HUDNote_c = HUDNote_c + 1 | |
HUDNote_i = HUDNote_i + 1 | |
end | |
function DrawBotNotice( self, k, v, i ) | |
local H = ScrH() / 1024 | |
local x = v.x - 75 * H | |
local y = v.y - 300 * H | |
if ( !v.w ) then | |
surface.SetFont( "AimBotBig" ) | |
v.w, v.h = surface.GetTextSize( v.text ) | |
end | |
local w = v.w | |
local h = v.h | |
w = w + 16 | |
h = h + 16 | |
draw.RoundedBox( 4, x - w - h + 8, y - 8, w + h, h, Color( 30, 30, 30, v.a * 0.4 ) ) | |
// Draw Icon | |
surface.SetDrawColor( 255, 255, 255, v.a ) | |
surface.SetTexture( NoticeMaterial[ v.type ] ) | |
surface.DrawTexturedRect( x - w - h + 16, y - 4, h - 8, h - 8 ) | |
draw.SimpleText( v.text, "AimBotBig", x+1, y+1, Color(0,0,0,v.a*0.8), TEXT_ALIGN_RIGHT ) | |
draw.SimpleText( v.text, "AimBotBig", x-1, y-1, Color(0,0,0,v.a*0.5), TEXT_ALIGN_RIGHT ) | |
draw.SimpleText( v.text, "AimBotBig", x+1, y-1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT ) | |
draw.SimpleText( v.text, "AimBotBig", x-1, y+1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT ) | |
draw.SimpleText( v.text, "AimBotBig", x, y, Color(255,255,255,v.a), TEXT_ALIGN_RIGHT ) | |
local ideal_y = ScrH() - (HUDNote_c - i) * (h + 4) | |
local ideal_x = ScrW() | |
local timeleft = v.len - (CurTime() - v.recv) | |
// Cartoon style about to go thing | |
if ( timeleft < 0.8 ) then | |
ideal_x = ScrW() - 50 | |
end | |
// Gone! | |
if ( timeleft < 0.5 ) then | |
ideal_x = ScrW() + w * 2 | |
end | |
local spd = FrameTime() * 15 | |
v.y = v.y + v.vely * spd | |
v.x = v.x + v.velx * spd | |
local dist = ideal_y - v.y | |
v.vely = v.vely + dist * spd * 1 | |
if (math.abs(dist) < 2 && math.abs(v.vely) < 0.1) then v.vely = 0 end | |
local dist = ideal_x - v.x | |
v.velx = v.velx + dist * spd * 1 | |
if (math.abs(dist) < 2 && math.abs(v.velx) < 0.1) then v.velx = 0 end | |
// Friction.. kind of FPS independant. | |
v.velx = v.velx * (0.95 - FrameTime() * 8 ) | |
v.vely = v.vely * (0.95 - FrameTime() * 8 ) | |
end | |
function PaintBotNotes() | |
if ( !HUDNotes ) then return end | |
local i = 0 | |
for k, v in pairs( HUDNotes ) do | |
if ( v != 0 ) then | |
i = i + 1 | |
DrawBotNotice( self, k, v, i) | |
end | |
end | |
for k, v in pairs( HUDNotes ) do | |
if ( v != 0 && v.recv + v.len < CurTime() ) then | |
HUDNotes[ k ] = 0 | |
HUDNote_c = HUDNote_c - 1 | |
if (HUDNote_c == 0) then HUDNotes = {} end | |
end | |
end | |
end | |
hook.Add("HUDPaint", "PaintBotNotes", PaintBotNotes) | |
local function SpazOn() | |
hook.Add("CreateMove", "Spaz", function(cmd) | |
cmd:SetViewAngles(cmd:GetViewAngles() * -1) | |
return cmd | |
end) | |
end | |
concommand.Add("entx_spazon", SpazOn) | |
local function SpazOff() | |
hook.Remove("CreateMove", "Spaz") | |
end | |
concommand.Add("entx_spazoff", SpazOff) | |
local function PrintAllEnts() | |
PrintTable(ents.GetAll()) | |
end | |
concommand.Add("entx_printallents", PrintAllEnts) | |
local function PrintEntTable(sender, command, arguments) | |
PrintTable(Entity(tonumber(arguments[1])):GetTable()) | |
end | |
concommand.Add("entx_printenttable", PrintEntTable) | |
local function EntSetValue(sender, command, arguments) | |
Entity(tonumber(arguments[1])):GetTable()[ arguments[2] ] = arguments[3] | |
end | |
concommand.Add("entx_setvalue", EntSetValue) | |
local function EntRunNone(sender, command, arguments) | |
local ent = Entity(tonumber(arguments[1])) | |
ent[ arguments[2] ](ent) | |
end | |
concommand.Add("entx_run", EntRunNone) | |
local function EntRun(sender, command, arguments) | |
local ent = Entity(tonumber(arguments[1])) | |
ent[ arguments[2] ](ent, arguments[3]) | |
end | |
concommand.Add("entx_run1", EntRun) | |
local function EntRunTwo(sender, command, arguments) | |
local ent = Entity(tonumber(arguments[1])) | |
ent[ arguments[2] ](ent, arguments[3], arguments[4]) | |
end | |
concommand.Add("entx_run2", EntRunTwo) | |
local function EntRunThree(sender, command, arguments) | |
local ent = Entity(tonumber(arguments[1])) | |
ent[ arguments[2] ](ent, arguments[3], arguments[4], arguments[5]) | |
end | |
concommand.Add("entx_run3", EntRunThree) | |
local function EntRunFour(sender, command, arguments) | |
local ent = Entity(tonumber(arguments[1])) | |
ent[ arguments[2] ](ent, arguments[3], arguments[4], arguments[5], arguments[6]) | |
end | |
concommand.Add("entx_run4", EntRunFour) | |
local function GetEnt(sender, command, arguments) | |
local tr = util.TraceLine(utilx.GetPlayerTrace(MySelf, MySelf:GetAimVector())) | |
if tr.Entity then | |
print(tostring(tr.Entity)) | |
end | |
end | |
concommand.Add("entx_traceget", GetEnt) | |
local function CamEnable() | |
MY_VIEW = MySelf:GetAimVector() | |
CAM_POS = MySelf:EyePos() | |
CAM_ANG = MySelf:GetAimVector() | |
hook.Add("CreateMove", "CamStopMove", function(cmd) | |
cmd:SetForwardMove(0) | |
cmd:SetUpMove(0) | |
cmd:SetSideMove(0) | |
return cmd | |
end) | |
function GAMEMODE:CalcView(ply, origin, angles, fov) | |
angles = angles:Forward() | |
local masktouse = COLLISION_GROUP_WORLD | |
if MySelf:KeyDown(IN_FORWARD) then | |
local tr = util.TraceLine({start = CAM_POS, endpos = CAM_POS + angles * FrameTime() * 200, mask=masktouse}) | |
CAM_POS = tr.HitPos | |
end | |
if MySelf:KeyDown(IN_BACK) then | |
local tr = util.TraceLine({start = CAM_POS, endpos = CAM_POS + angles * FrameTime() * -200, mask=masktouse}) | |
CAM_POS = tr.HitPos | |
end | |
if MySelf:KeyDown(IN_MOVELEFT) then | |
local tr = util.TraceLine({start = CAM_POS, endpos = CAM_POS + angles:Angle():Right() * FrameTime() * -200, mask=masktouse}) | |
CAM_POS = tr.HitPos | |
end | |
if MySelf:KeyDown(IN_MOVERIGHT) then | |
local tr = util.TraceLine({start = CAM_POS, endpos = CAM_POS + angles:Angle():Right() * FrameTime() * 200, mask=masktouse}) | |
CAM_POS = tr.HitPos | |
end | |
local view = {} | |
view.origin = CAM_POS | |
view.angles = angles:Angle() | |
view.fov = fov | |
return view | |
end | |
end | |
concommand.Add("entx_camenable", CamEnable) | |
local function CamDisable() | |
hook.Remove("CreateMove", "CamStopMove") | |
function GAMEMODE:CalcView(ply, origin, angles, fov) | |
local view = {} | |
view.origin = origin | |
view.angles = angles | |
view.fov = fov | |
return view | |
end | |
end | |
concommand.Add("entx_camdisable", CamDisable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment