I want to make a real time velocity gauge hud, I used [url=http://wiki.garrysmod.com/?title=Creating_a_HUD]this great hud tutorial[/url] to achieve this:
[img]http://up.1337.jp/vel3.jpg[/img]
( this obviously showing hp and not velocity )
[url=http://up.1337.jp/vel.jpg]And this is what I want to achieve.[/url]
Accomplished, scroll down
[url]http://wiki.garrysmod.com/?title=Entity.GetVelocity[/url]
And you got brackets on line 120. Make that:
[lua]
if !client:Alive() then return end
[/lua]
Next Day:
Well, Did that solve your problem?
edit: I am blind, I need to look 2 lines down sometimes.
local text = string.format( "Velocity: %i", client:GetVelocity():Length( ) ); -- get velocity text
good_hud:PaintText( cx, cy, text, vars.font, colors.text ); -- paint health text and health bar
good_hud:PaintBar( cx, cy + by, bar_width, vars.bar_height, colors.health_bar, client:GetVelocity():Length( ) / 1024 ); -- paint the bar
Can someone verify that I didn't make a noob mistake / if there are any improvements that can be made?
This is my first day doing lua.
[media]http://www.youtube.com/watch?v=TaddmHRUxBA[/media]
in action
Is this client-sided? I would love for you to release this code..would work great with CSS BHOP
As far as I'm aware there is no way of doing something like this in CSS.
You can't add new VGUI elements like this.
No, but you can add a lua uhh i forget what it's called, but it allows ou to use lua with CSS
[QUOTE=c-unit;21440418]No, but you can add a lua uhh i forget what it's called, but it allows ou to use lua with CSS[/QUOTE]
LSS is useful but surely it can't draw on the hud?
You cant use LSS for drawing anything on screen and the coder says he could but it would trigger vac
Wow, you would think that VAC wouldn't be so sensative, Drawing a HUD triggering VAC ban?
Why would they support it when its used for exploiting the game? Other players have no need to draw to screen if they did it would be a feature in css
*Boop* lol..
I'm currently making one too but in 2013.
This is what I have for now. It works great but the Number for on for ages (123.456789123)
Can someone help?
[CODE]function GM:HUDPaint()
self.BaseClass:HUDPaint()
local ply = LocalPlayer()
local VEL = LocalPlayer():GetVelocity():Length()
surface.CreateFont( "MyFont", {
font = "Arial",
size = 30,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false
})
surface.SetTextColor( 255, 255, 255, 255)
surface.SetTextPos( 20, 20 )
surface.SetFont( "MyFont" )
surface.DrawText( VEL )
end[/CODE]
woow what a terrible bump..
this thread is more than 3 years old, and you couldn't simply just start a new thread instead of searching the bottom of the forums for this?
[QUOTE=mitterdoo;41850925]woow what a terrible bump..
this thread is more than 3 years old, and you couldn't simply just start a new thread instead of searching the bottom of the forums for this?[/QUOTE]
This isn't a bump, this is an update because the old LUA strings don't work anymore.
[QUOTE=Ho7s0;41850968]This isn't a bump, this is an update because the old LUA strings don't work anymore.[/QUOTE]
still, it's very obvious you shouldn't revive a 3-year old thread, especially in facepunch. it's bannable.
if your problem is the bar showing floats instead of integers, use [url=http://wiki.garrysmod.com/page/math/Round]math.Round()[/url]
Create fonts outside of the paint hook, else it will cause some font problems, like all the fonts going black.
[QUOTE=mitterdoo;41851012]still, it's very obvious you shouldn't revive a 3-year old thread, especially in facepunch. it's bannable.
if your problem is the bar showing floats instead of integers, use [url=http://wiki.garrysmod.com/page/math/Round]math.Round()[/url][/QUOTE]
Yes, sorry about this.
Also, where exactly will I place the math.Round()?
[QUOTE]Create fonts outside of the paint hook, else it will cause some font problems, like all the fonts going black.[/QUOTE]
Thanks for telling, changed it just now! :)
[QUOTE=Ho7s0;41859776]
Also, where exactly will I place the math.Round()?[/QUOTE]
[lua]
local VEL = math.Round(LocalPlayer():GetVelocity():Length())
[/lua]
Sorry, you need to Log In to post a reply to this thread.