[QUOTE=Pigsy;48704077]How would I go about drawing 3d2d ontop of a SWEP viewmodel? An example would be great.[/QUOTE]
My guess would be to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/PostDrawViewModel]WEAPON/PostDrawViewModel[/url] and then use cam.Start3D2D() inside of that, and it should draw all of your 3d2d stuff on top of the view model.
[code]
local mat = Material("debug/debugdrawflat")
function SWEP:PostDrawViewModel( vm, ply, weapon )
local pos = vm:LookupAttachment( "muzzle" )
cam.Start3D2D(pos, Angle(0,0,0), 1) -- Not sure about the angles, you may have to rotate them a bit.
surface.SetMaterial(mat)
surface.SetDrawColor(color_white)
surface.DrawRect(0, 0, 20, 20)
cam.End3D2D()
end
[/code]
[QUOTE=Z0mb1n3;48704181]My guess would be to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/PostDrawViewModel]WEAPON/PostDrawViewModel[/url] and then use cam.Start3D2D() inside of that, and it should draw all of your 3d2d stuff on top of the view model.
[code]
local mat = Material("debug/debugdrawflat")
function SWEP:PostDrawViewModel( vm, ply, weapon )
local pos = vm:LookupAttachment( "muzzle" )
cam.Start3D2D(pos, Angle(0,0,0), 1) -- Not sure about the angles, you may have to rotate them a bit.
surface.SetMaterial(mat)
surface.SetDrawColor(color_white)
surface.DrawRect(0, 0, 20, 20)
cam.End3D2D()
end
[/code][/QUOTE]
It will still clip into the view model as far as I know.
Thanks so much :)
[QUOTE=Robotboy655;48704194]It will still clip into the view model as far as I know.[/QUOTE]
yeah I just tried it, definitely clips.
Why when I join a server it shows that I am downloading the materials etc. but once I am on the server everything is till black/ping?
[QUOTE=Shenesis;48704948]Badly set up FastDL I think[/QUOTE]
so could the problem be with the resource.AddFile location?
[editline]17th September 2015[/editline]
Also is it a bad thing using SetNWInt/String ??
[IMG]http://i.imgur.com/M04YD7B.png[/IMG]
How do I get the ID when I press the button? :(
Hello everyone,
Is there anyway someone can help me compile [URL="https://bitbucket.org/danielga/gmod_lanes/src"]gmod_lanes[/URL]?
I am trying to compile it but it comes back with an error.
[CODE]Error 1 error LNK2019: unresolved external symbol _luaopen_lanes_core referenced in function _gmod13_open C:\~\project\main.obj
[/CODE]
I have absolutely no clue what I am doing :P
I am at a point where I need to fix
[CODE]if (luaopen_lanes_core( state ) >= 1)[/CODE]
If I comment that line it compiles. But also does not work. (not sure if it works anyway. Because it does not seem to do a PushCFunction.)
Any help is appreciated.
Thanks
[QUOTE=darkjacky;48705601]-stuff-[/QUOTE]
luaopen_lanes_core needs to be included in the build, statically if you don't want to change anything. Google tells me that's part of [URL="this"]https://github.com/LuaLanes/lanes[/URL].
[QUOTE=RedNinja;48705590][IMG]http://i.imgur.com/M04YD7B.png[/IMG]
How do I get the ID when I press the button? :([/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DListView/GetSelectedLine]DListView/GetSelectedLine[/url]
[QUOTE=>>oubliette<<;48705680]luaopen_lanes_core needs to be included in the build, statically if you don't want to change anything. Google tells me that's part of [URL="this"]https://github.com/LuaLanes/lanes[/URL].[/QUOTE]
It is. Visual Studio says its valid function. But when you call it it breaks.
[QUOTE=darkjacky;48705717]It is. Visual Studio says its valid function. But when you call it it breaks.[/QUOTE]
You didn't actually link LuaLanes crap to your module I guess. Just #include'ing a header isn't enough, you need tell the linker to use a .lib file or just embed the whole thing into the module (i.e. add its full source code to the project and compile like that).
[QUOTE=mijyuoon;48705781]You didn't actually link LuaLanes crap to your module I guess. Just #include'ing a header isn't enough, you need tell the linker to use a .lib file or just embed the whole thing into the module (i.e. add its full source code to the project and compile like that).[/QUOTE]
This means separately compiling right? <- no idea how to do that. But I will go ahead and see where I can get. (I did add the full source + lua source because it required that. it said that it could not include "lanes.h" and after it said so about "lua.h")
I have a file.Write (log.txt, mytable) that works...but the table is all on one line...how do I parse it to create new lines all neat so that each variable in the table is on a new line. I tried \n in the variable strings but that didn't work. (table actually stated "my variable string\n"
Ok, with that done I now get these errors.
[CODE]
Error 1 error LNK2005: _main already defined in lua.obj C:\~\project\luac.obj
Error 2 error LNK2005: _luaopen_io already defined in liolib.obj C:\~\project\main.obj
Error 3 error LNK1169: one or more multiply defined symbols found C:\~\bin\gm_my_module_win32.dll 1 1
[/CODE]
Ok... That seems to be a fine error. But how do I go and work on this? I commented one of the functions in error 1 and 2. Then it does compile, however when doing require("lanes_core") source dedicated server crashes.
The error:
[CODE]Process Name: srcds.exe : C:\steam\gmod\srcds.exe
Process Architecture: x86
Exception Code: 0xC0000005
Exception Information: The thread tried to read from or write to a virtual address for which it does not have the appropriate access.[/CODE]
How would one fix this when he has absolutely no clue?
[QUOTE=Blakestr;48705887]I have a file.Write (log.txt, mytable) that works...but the table is all on one line...how do I parse it to create new lines all neat so that each variable in the table is on a new line. I tried \n in the variable strings but that didn't work. (table actually stated "my variable string\n"[/QUOTE]
Either write something yourself to go through each value and write it to the file followed by a newline, or use [url=http://wiki.garrysmod.com/page/util/TableToJSON]util/TableToJSON[/url].
[QUOTE=darkjacky;48706020]How would one fix this when he has absolutely no clue?[/QUOTE]
I doubt you can fix that, I don't really know how LuaLanes implements multithreading but it is bound to cause problems in a single threaded application. There are actually of functions in GMod that will exit the game when they are called from a separate thread.
[QUOTE=roastchicken;48706024]Either write something yourself to go through each value and write it to the file followed by a newline, or use [url=http://wiki.garrysmod.com/page/util/TableToJSON]util/TableToJSON[/url].[/QUOTE]
I am using util.TableToJSON .... it all ends up on one line...
[QUOTE=Blakestr;48706762]I am using util.TableToJSON .... it all ends up on one line...[/QUOTE]
[URL="http://wiki.garrysmod.com/page/util/TableToJSON"]util.TableToJSON[/URL] takes a second optional boolean variable for pretty printing.
What's the advantage of using
[CODE]
tobool(GetConVar('var'):GetInt())
[/CODE]
over
[CODE]
tobool(GetConVarNumber('var'))
[/CODE] or
[CODE]
GetConVar('var'):ToString()
[/CODE] over
[CODE]
GetConVarString('var')
[/CODE] The first option seems to get used more (and doesn't use GetConVar():ToBool())
How would I go on about attaching a think hook to a FindMetaTable("Player") function?
[QUOTE=MPan1;48709301]What's the advantage of using
[CODE]
tobool(GetConVar('var'):GetInt())
[/CODE]
over
[CODE]
tobool(GetConVarNumber('var'))
[/CODE] or
[CODE]
GetConVar('var'):ToString()
[/CODE] over
[CODE]
GetConVarString('var')
[/CODE] The first option seems to get used more (and doesn't use GetConVar():ToBool())[/QUOTE]
There's no advantage if you use like in your example. There IS an advantage though if you cache result of GetConVar() and then just use a variable because GetConVar() isn't very fast.
[QUOTE=MPan1;48709301]GetConVar or GetConVar*?[/QUOTE]
[QUOTE=mijyuoon;48709854]words[/QUOTE]
To expand on mijyuoon's post:
This is the ultimate and correct way to do it:
[lua]
-- top of your file
local ttt_karma_starting = GetConVar("ttt_karma_starting")
-- when you need it
print("The starting karma is: " .. ttt_karma_starting:GetString())
local newkarma = ttt_karma_starting:GetInt() * 0.8
[/lua]
The reasoning behind this is GetConVar* all call this internally:
[lua]
function GetConVarString(cvarname)
return GetConVar(cvarname):GetString()
end
-- etc
[/lua]
GetConVar is a particularly slow function, and we don't want to retrieve the convar object every call if we can just store it. As well, you can do more with the convar object as opposed to those static functions. The GetConVar* functions are listed as deprecated on the wiki because of these flaws.
Someone tell me why a docked panel returns its original size :VVVVVVVVVVVVVVVVVVVVVVVVVVVV
HELP
Just wondering if there's a way to get a list of prop_statics in the map and their positions/angles without reading the BSP lump. Thanks.
Apart from lots of money with little to no effort, what do people expect in a DarkRP server these days?
I mean, I'm just throwing together a quick server to playerbait for HDG's upcoming roleplay gamemode, but i need to make sure that playerbait works.
[QUOTE=maurits150;48714574]Just wondering if there's a way to get a list of prop_statics in the map and their positions/angles without reading the BSP lump. Thanks.[/QUOTE]
Maybe [url=http://wiki.garrysmod.com/page/ents/FindByClass]This?[/url]
[code]
for k,v in pairs(ents.FindByClass("prop_static")) do
print(v:GetPos())
print(v:GetAng())
end
[/code]
[QUOTE=Kevlon;48714567]Someone tell me why a docked panel returns its original size :VVVVVVVVVVVVVVVVVVVVVVVVVVVV
HELP[/QUOTE]
are you daft?
[IMG]http://i.imgur.com/1k2gO4H.png[/IMG]
[QUOTE=ScarehGhoost;48715237]Maybe [url=http://wiki.garrysmod.com/page/ents/FindByClass]This?[/url]
[code]
for k,v in pairs(ents.FindByClass("prop_static")) do
print(v:GetPos())
print(v:GetAng())
end
[/code][/QUOTE]
I wish it was that easy, but static props aren't stored as an entity and are hard baked into the map during compilation.
[img]https://maurits.tv/data/img/September%202015/2015-09-19_03-33-39_VSlZhrDvxOQbTo7z.png[/img]
[QUOTE=maurits150;48715510]I wish it was that easy, but static props aren't stored as an entity and are hard baked into the map during compilation.
[img]https://maurits.tv/data/img/September%202015/2015-09-19_03-33-39_VSlZhrDvxOQbTo7z.png[/img][/QUOTE]
unrelated, but for sequential tables use the length operator. table.Count is a GarryFunction™ and iterates over the table to get length.
Sorry, you need to Log In to post a reply to this thread.