InfoGarry's Mod Script Thread

Posts 61–75 of 219 · Page 5 of 15
Quote Originally Posted by Gray View Post


Saying this beforehand, I'm not good with coding.
But it seems fine other than the fact that it says "pl" instead of ply.

And it should probably be using k, v in pairs instead of the other.
@kila58 @iMythik.
Why did you wake me up?
Anyways, do you want me to update this or some shit?
Quote Originally Posted by kila58 View Post
Why did you wake me up?
Anyways, do you want me to update this or some shit?
Wake you up? Wishful thinking thar.
And yeah, I think that's what this guy want.
Quote Originally Posted by Gray View Post


Wake you up? Wishful thinking thar.
And yeah, I think that's what this guy want.
I'll see what I can do.
I have a few projects on my hands as it is.
Quote Originally Posted by kila58 View Post
I'll see what I can do.
I have a few projects on my hands as it is.
It's completely up to you, I only know two people on here that actually code their own stuff and know enough to maybe convert stuff.
And I'm not one of them.
I'm 'onna revive this thing.
I wanted to see if someone made a breakthrough in converting the witnesses script?
Quote Originally Posted by Gray View Post
I'm 'onna revive this thing.
I wanted to see if someone made a breakthrough in converting the witnesses script?
Yea tomorrow I was going to work on it.
It would be useful for a legit hack.
Quote Originally Posted by kila58 View Post
Yea tomorrow I was going to work on it.
It would be useful for a legit hack.
Thanks man. I was going to take a look at it and try and learn some stuff but finals kind of snuck up on me so I've been on lockdown for the past week or so.
Any help would be greatly appreciated.
Did you ever get around to taking a look? In any event I stumbled across an old lua script that lets you measure distances. Only error it had is that it was trying to use a default font. Just spent about 10 hours in a server with this on. Works perfect as far as I can tell.

Code:
/**
	Splambob's quick clientside distance script.
		Bind a key to "distance_press" to use.
		Press key twice to define two points, press again to remove results.
		Outputs results to console for copy/pasta.
//*/



if not CLIENT then return end


local DistStage = 1
local DistVec1 = nil
local DistVec2 = nil
local DistShouldPaint = false
local DistBetween = 0

surface.CreateFont("InfoFont",{font = "ScoreboardText", size = 14, weight = 400, antialias = 1})
local InfoSep	= 0		// Seperation between lines
local InfoXOff	= 12	// Offsets from player centre
local InfoYOff	= -11



surface.SetFont("InfoFont")
// IWidth is never used.
local IWidth, FontHeight = surface.GetTextSize("I")

local client = client or LocalPlayer()



/**
	DistM_Init
		Assigns local player to client variable after entity initialisation.
		This is a bugfix.
//*/
function DistM_Init()
	client = LocalPlayer()
end
hook.Add( "InitPostEntity", "DistM_RunInitHook", DistM_Init )



/**
	DistM_Paint
		Painty things.
//*/
function DistM_Paint()
	
	if DistShouldPaint then
	
		DistM_Stages[DistStage]()
	
		local DrawDist = false
		if DistVec2 != nil then
				local ScrCen = DistVec2:ToScreen()
				
				DrawDist = true
				DistBetween = DistVec2:Distance(DistVec1)
				
				DistM_DrawLine()
				DistM_DrawBox(ScrCen)
				DistM_DrawText(DistVec2, ScrCen, true, DistBetween)
		end
	
		if DistVec1 != nil then
				local ScrCen = DistVec1:ToScreen()
				
				DistM_DrawBox(ScrCen)
				DistM_DrawText(DistVec1, ScrCen, DrawDist, DistBetween)
		end
		
	end
	
end
hook.Add( "HUDPaint", "DistThink", DistM_Paint )



function DistM_DrawLine()

	surface.SetDrawColor( 255, 255, 255, 255)	// colour of line between two points
	local Scr1 = DistVec1:ToScreen()
	local Scr2 = DistVec2:ToScreen()
	surface.DrawLine(Scr1.x, Scr1.y, Scr2.x, Scr2.y)
	
end



function DistM_DrawBox(ScrVec)

	surface.SetDrawColor( 0, 0, 0, 255)		// colour of point dropshadow
		surface.DrawOutlinedRect( ScrVec.x-7, ScrVec.y-7, 16, 16 )
		surface.DrawOutlinedRect( ScrVec.x, ScrVec.y, 2, 2 )
	
	surface.SetDrawColor( 255, 255, 0, 255)	// colour of point marker
		surface.DrawOutlinedRect( ScrVec.x-1, ScrVec.y-1, 2, 2 )
		surface.DrawOutlinedRect( ScrVec.x-8, ScrVec.y-8, 16, 16 )
		
end



function DistM_ToVecString(Vec)
	return "( "..(math****und(Vec.x*10)/10)..", "..(math****und(Vec.y*10)/10)..", "..(math****und(Vec.z*10)/10).." )"
end



function DistM_ToDistString(Dist)
	return (math****und(Dist*10)/10).." glu  ("..(math****und(Dist*0.01905*10)/10).." m)"
end



function DistM_DrawText(Vec, ScrVec, DispDist, Dist)

	surface.SetFont("InfoFont")
	surface.SetTextColor( 255, 255, 255, 255 )
	
	local TextRow = 0
	
	
	local PVec = DistM_ToVecString(Vec)
	DistM_DrawInfoLine(PVec, TextRow, ScrVec)
	
	TextRow = TextRow + 1
	

	if DispDist then
		local PDist = DistM_ToDistString(Dist)
		DistM_DrawInfoLine(PDist, TextRow, ScrVec)
		//TextRow = TextRow + 1  //uncomment this if adding more info
	end
	
end



/**
	DistM_DrawInfoLine(Str, Line, Vec) (v1)
		Draws an info line given a specified line, string and box position.
		Requires font info to be set up, except the position.
//*/
function DistM_DrawInfoLine(Str, Line, Vec)

	local PNPos		= Vector(Vec.x + InfoXOff, Vec.y + InfoYOff + (FontHeight + InfoSep)*Line, 0)
				
	surface.SetTextPos( PNPos.x, PNPos.y )
	surface.DrawText(Str)
	
end



DistM_Stages = 
{
	// If you want the point marker to be visible before placement, uncommand the below line
	// and change all instances of "DistStage = 1" to "DistStage = 0"
	//[0] =	function()	DistShouldPaint = true	end,
	
	[1] = 	function()
				local vec1trace = LocalPlayer():GetEyeTrace()
				DistVec1 = vec1trace.HitPos
				DistShouldPaint = true
			end,
			
	[2] = 	function()
				local vec2trace = LocalPlayer():GetEyeTrace()
				DistVec2 = vec2trace.HitPos
				DistShouldPaint = true
			end,
			
	[3] =	function() end,
	
	[4]	=	function()
				DistShouldPaint = false
				DistVec1 = nil
				DistVec2 = nil
				DistBetween = 0
				DistStage = 1
			end
}



/**
	DistM_Command
		Commandy things.
//*/
function DistM_Command(player,command,arguments)

	DistM_Stages[DistStage]()
	DistStage = DistStage + 1
	
	if DistStage == 3 then
		Dist 	= DistM_ToDistString(DistVec2:Distance(DistVec1))
		VStr1 	= DistM_ToVecString(DistVec1)
		VStr2 	= DistM_ToVecString(DistVec2)
	
		Msg("\n-- Distance Measure Output: --\n\n")
		Msg("\tDistance: "..Dist.."\n\n")
		Msg("\tVector 1: "..VStr1.."\n")
		Msg("\tVector 2: "..VStr2.."\n\n")
		Msg("------------------------------\n")
	end
	
end
concommand.Add( "distance_press", DistM_Command )
Bind a key to "distance_press". 1st click places 1st point, 2nd click 2nd point, 3rd clears points.
Quote Originally Posted by hermy11 View Post
Did you ever get around to taking a look? In any event I stumbled across an old lua script that lets you measure distances. Only error it had is that it was trying to use a default font. Just spent about 10 hours in a server with this on. Works perfect as far as I can tell.

Code:
/**
	Splambob's quick clientside distance script.
		Bind a key to "distance_press" to use.
		Press key twice to define two points, press again to remove results.
		Outputs results to console for copy/pasta.
//*/



if not CLIENT then return end


local DistStage = 1
local DistVec1 = nil
local DistVec2 = nil
local DistShouldPaint = false
local DistBetween = 0

surface.CreateFont("InfoFont",{font = "ScoreboardText", size = 14, weight = 400, antialias = 1})
local InfoSep	= 0		// Seperation between lines
local InfoXOff	= 12	// Offsets from player centre
local InfoYOff	= -11



surface.SetFont("InfoFont")
// IWidth is never used.
local IWidth, FontHeight = surface.GetTextSize("I")

local client = client or LocalPlayer()



/**
	DistM_Init
		Assigns local player to client variable after entity initialisation.
		This is a bugfix.
//*/
function DistM_Init()
	client = LocalPlayer()
end
hook.Add( "InitPostEntity", "DistM_RunInitHook", DistM_Init )



/**
	DistM_Paint
		Painty things.
//*/
function DistM_Paint()
	
	if DistShouldPaint then
	
		DistM_Stages[DistStage]()
	
		local DrawDist = false
		if DistVec2 != nil then
				local ScrCen = DistVec2:ToScreen()
				
				DrawDist = true
				DistBetween = DistVec2:Distance(DistVec1)
				
				DistM_DrawLine()
				DistM_DrawBox(ScrCen)
				DistM_DrawText(DistVec2, ScrCen, true, DistBetween)
		end
	
		if DistVec1 != nil then
				local ScrCen = DistVec1:ToScreen()
				
				DistM_DrawBox(ScrCen)
				DistM_DrawText(DistVec1, ScrCen, DrawDist, DistBetween)
		end
		
	end
	
end
hook.Add( "HUDPaint", "DistThink", DistM_Paint )



function DistM_DrawLine()

	surface.SetDrawColor( 255, 255, 255, 255)	// colour of line between two points
	local Scr1 = DistVec1:ToScreen()
	local Scr2 = DistVec2:ToScreen()
	surface.DrawLine(Scr1.x, Scr1.y, Scr2.x, Scr2.y)
	
end



function DistM_DrawBox(ScrVec)

	surface.SetDrawColor( 0, 0, 0, 255)		// colour of point dropshadow
		surface.DrawOutlinedRect( ScrVec.x-7, ScrVec.y-7, 16, 16 )
		surface.DrawOutlinedRect( ScrVec.x, ScrVec.y, 2, 2 )
	
	surface.SetDrawColor( 255, 255, 0, 255)	// colour of point marker
		surface.DrawOutlinedRect( ScrVec.x-1, ScrVec.y-1, 2, 2 )
		surface.DrawOutlinedRect( ScrVec.x-8, ScrVec.y-8, 16, 16 )
		
end



function DistM_ToVecString(Vec)
	return "( "..(math****und(Vec.x*10)/10)..", "..(math****und(Vec.y*10)/10)..", "..(math****und(Vec.z*10)/10).." )"
end



function DistM_ToDistString(Dist)
	return (math****und(Dist*10)/10).." glu  ("..(math****und(Dist*0.01905*10)/10).." m)"
end



function DistM_DrawText(Vec, ScrVec, DispDist, Dist)

	surface.SetFont("InfoFont")
	surface.SetTextColor( 255, 255, 255, 255 )
	
	local TextRow = 0
	
	
	local PVec = DistM_ToVecString(Vec)
	DistM_DrawInfoLine(PVec, TextRow, ScrVec)
	
	TextRow = TextRow + 1
	

	if DispDist then
		local PDist = DistM_ToDistString(Dist)
		DistM_DrawInfoLine(PDist, TextRow, ScrVec)
		//TextRow = TextRow + 1  //uncomment this if adding more info
	end
	
end



/**
	DistM_DrawInfoLine(Str, Line, Vec) (v1)
		Draws an info line given a specified line, string and box position.
		Requires font info to be set up, except the position.
//*/
function DistM_DrawInfoLine(Str, Line, Vec)

	local PNPos		= Vector(Vec.x + InfoXOff, Vec.y + InfoYOff + (FontHeight + InfoSep)*Line, 0)
				
	surface.SetTextPos( PNPos.x, PNPos.y )
	surface.DrawText(Str)
	
end



DistM_Stages = 
{
	// If you want the point marker to be visible before placement, uncommand the below line
	// and change all instances of "DistStage = 1" to "DistStage = 0"
	//[0] =	function()	DistShouldPaint = true	end,
	
	[1] = 	function()
				local vec1trace = LocalPlayer():GetEyeTrace()
				DistVec1 = vec1trace.HitPos
				DistShouldPaint = true
			end,
			
	[2] = 	function()
				local vec2trace = LocalPlayer():GetEyeTrace()
				DistVec2 = vec2trace.HitPos
				DistShouldPaint = true
			end,
			
	[3] =	function() end,
	
	[4]	=	function()
				DistShouldPaint = false
				DistVec1 = nil
				DistVec2 = nil
				DistBetween = 0
				DistStage = 1
			end
}



/**
	DistM_Command
		Commandy things.
//*/
function DistM_Command(player,command,arguments)

	DistM_Stages[DistStage]()
	DistStage = DistStage + 1
	
	if DistStage == 3 then
		Dist 	= DistM_ToDistString(DistVec2:Distance(DistVec1))
		VStr1 	= DistM_ToVecString(DistVec1)
		VStr2 	= DistM_ToVecString(DistVec2)
	
		Msg("\n-- Distance Measure Output: --\n\n")
		Msg("\tDistance: "..Dist.."\n\n")
		Msg("\tVector 1: "..VStr1.."\n")
		Msg("\tVector 2: "..VStr2.."\n\n")
		Msg("------------------------------\n")
	end
	
end
concommand.Add( "distance_press", DistM_Command )
Bind a key to "distance_press". 1st click places 1st point, 2nd click 2nd point, 3rd clears points.
Good contribution!
Although I don't think I'll use it, distance isn't really useful for me.

Small annoying flashlight spam when you hold down H.
Yes this has been done before, yes you may not like H as spam key (change it yourself as well as "lenny_flashlight" if you dont like it) and yes it may not be perfect.

Code:
CreateClientConVar("lenny_flashlight", 0, true, false)

function Flashspam()
	if GetConVar("lenny_flashlight"):GetInt() == 1 then
		if input.IsKeyDown(KEY_H) then
			RunConsoleCommand("impulse", "100")
			return end
	end
end

hook.Add("Think", "Flspam", Flashspam )

You can find all my other scripts here: https://github.com/LennyPenny/LennysUtilities/tree/master/Lenny's_Scripts/lua/Lenny
They are not perfect, not original and not optimized.
Quote Originally Posted by LennyPenny View Post

Small annoying flashlight spam when you hold down H.
Yes this has been done before, yes you may not like H as spam key (change it yourself as well as "lenny_flashlight" if you dont like it) and yes it may not be perfect.

Code:
CreateClientConVar("lenny_flashlight", 0, true, false)

function Flashspam()
	if GetConVar("lenny_flashlight"):GetInt() == 1 then
		if input.IsKeyDown(KEY_H) then
			RunConsoleCommand("impulse", "100")
			return end
	end
end

hook.Add("Think", "Flspam", Flashspam )

You can find all my other scripts here: https://github.com/LennyPenny/LennysUtilities/tree/master/Lenny's_Scripts/lua/Lenny
They are not perfect, not original and not optimized.
Thanks for contributing. I'll be testing out your triggerbot on a DarkRP server. Never did fancy aimbots quite as much as triggerbots.
Will also test the updated witnesses script and report back on that.

EDIT: triggerbot and witnesses script confirmed working. using BindToggle (I think that comes from Fptje's Small Scripts. Not sure since it's been ages since I've played a game of Gmod without it on) to make turning it off and on bound to 1 key makes for some slick toggling.
Yeah the aimbot is pretty shit and I'm not going to make it any better I guess, not so much my thing and there's plenty alternatives out there.
Just note that these are pretty much my first lua scripts and some of them have big problems.
Fixed the witness script from Hermy11 I think:
Code:
    local Cap = math.cos(math.rad(45))
    local Offset = Vector(0, 0, 32)
    local Trace = {}

    function Draw()
    	local Time = os.time() - 1
    	local Witnesses = 0
    	local BeingWitnessed = true
    	local Texture = surface.GetTextureID("gui/silkicons/emoticon_smile")

    	if Time < os.time() then
    		Time = os.time() + .5
    		Witnesses = 0
    		BeingWitnessed = false
    		for k, pla in pairs(player.GetAll()) do
    			if pla:IsValid() and pla != LocalPlayer() then
    				Trace.start  = LocalPlayer():EyePos() + Offset
    				Trace.endpos = pla:EyePos() + Offset
    				Trace.filter = {pla, LocalPlayer()}

    				TraceRes = util.TraceLine(Trace)

    				if !TraceRes.Hit then
    					if (pla:EyeAngles():Forward():Dot((LocalPlayer():EyePos() - pla:EyePos())) > Cap) then
    						Witnesses = Witnesses + 1
    						BeingWitnessed = true

    					end
    				end
    			end
    		end
    	end

    	surface.SetFont("BudgetLabel")
    	if BeingWitnessed then
    		surface.SetTextColor(255, 000, 000, 255)
    		Texture = surface.GetTextureID("gui/silkicons/exclamation")
    	else
    		surface.SetTextColor(000, 255, 000, 255)
    		Texture = surface.GetTextureID("gui/silkicons/emoticon_smile")
    	end
    	local Text = "Witnesses: "..tostring(Witnesses)
    	local Width, Height = surface.GetTextSize(Text)

    	surface.SetDrawColor(80, 80, 80, 180)
    	surface.DrawRect(ScrW()/2 - (Width/2 + 24), 4, Width + 28, Height + 8)
    	surface.SetDrawColor(0, 0, 0, 255)
        surface.DrawOutlinedRect(ScrW()/2 - (Width/2 + 24), 4, Width + 28, Height + 8)

    	surface.SetTexture(Texture)
    	surface.SetDrawColor(255, 255, 255, 255)
    	surface.DrawTexturedRect(ScrW()/2 - (Width/2 + 20), 8, 16, 16)
    	surface.SetTextPos(ScrW()/2 - Width/2, 8)
    	surface.DrawText(Text)
    end
    hook.Add("HUDPaint", "WitnessesBox", Draw)
Just had to remove ":normalize()" in line 24.

Awesome script Henry11, keep it coming!
So the key is Space Bar, but my jump key is Keypad_Plus, so what do i replace KEY_SPACE with to make it Keypad_Plus?

On the iHop Script
Quote Originally Posted by MrRazer8 View Post
So the key is Space Bar, but my jump key is Keypad_Plus, so what do i replace KEY_SPACE with to make it Keypad_Plus?

On the iHop Script
That sounded pretty self explanatory.
If it doesn't work as is, then try your way.
Posts 61–75 of 219 · Page 5 of 15

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?