Hey, im trying to draw a box above all the spawn points on the map through client side
This is my code so far
for k,v in pairs(ents.FindByClass("info_player_start")) do
local pos = v:GetPos() + Vector(0,0,50)
local ang = v:GetAngles()
Msg("Found Spawn Point")
cam.Start3D(pos,ang)
draw.RoundedBox( 8, 50, 50, 100, 100, Color( 255, 255, 255 ) )
cam.End3D()
end
if it makes a difference im running it by going lua_openscript_cl test.lua
You need to put this in a 3D rendering hook, at the moment it may be drawing this for one frame only.
here are some 3D rendering hooks that i have got to work with drawing:
[b]PostPlayerDraw[/b]
[b]PrePlayerDraw[/b]
[b]RenderScene[/b]
Thanks, but its not working
this is what i tried
function DrawBox()
for k,v in pairs(ents.FindByClass("info_player_start")) do
local pos = v:GetPos() + Vector(0,0,50)
local ang = v:GetAngles()
Msg("Found Spawn Point")
cam.Start3D(pos,ang)
draw.RoundedBox( 8, 50, 50, 100, 100, Color( 255, 255, 255 ) )
cam.End3D()
end
end
hook.Add("PostPlayerDraw", "DrawBox", DrawBox)
Change this:
[code]local ang = v:GetAngles()[/code]
to
[code]local ang = LocalPlayer():EyeAngles()[/code]
See if that works.
[QUOTE=MakeR;16999504]Change this:
[code]local ang = v:GetAngles()[/code]
to
[code]local ang = LocalPlayer():EyeAngles()[/code]
See if that works.[/QUOTE]
Still nothing :(
Its not even saying "Spawn Point Found"
Try using one of the other rendering hooks.
[QUOTE=MakeR;16999528]Try using one of the other rendering hooks.[/QUOTE]
Ive tried all of the hooks
I wouldn't normally suggest rendering in 3D in a HUDPaint hook, but try that.
[QUOTE=MakeR;16999590]I wouldn't normally suggest rendering in 3D in a HUDPaint hook, but try that.[/QUOTE]
Nothing :/
[editline]02:00PM[/editline]
Is the something wrong with my code?
Or is there just no interval?
It seems that info_player_starts are not available clientside (try putting this into the console: [i]lua_run_cl PrintTable(ents.FindByClass("info_player_start"))[/i]).
[editline]02:05PM[/editline]
So your for loop isn't running.
[QUOTE=MakeR;16999809]It seems that info_player_starts are not available clientside (try putting this into the console: [i]lua_run_cl PrintTable(ents.FindByClass("info_player_start"))[/i]).
[editline]02:05PM[/editline]
So your for loop isn't running.[/QUOTE]
ahh i see, its not showing
this means you cand find them through client side right?
Btw is it possible to parent the box to a entity such as a player
Of course, just use the position of a player. Should be obvious enough if you know what you are doing.
As far as I know, info_player_start at any other point entities don't even exist clientside.
Sorry, you need to Log In to post a reply to this thread.