[img]http://i.imgur.com/SMkKsi4.png[/img]
Previous thread hit max posts, thought I'd re-make it.
[B]Welcome to Problems That Don't Need Their Own Thread v 3![/b]
Have a small problem you can't figure out, but don't believe it's worth creating a whole new thread
for the sole purpose of getting your problem fixed? Then you've come to the right thread!
[B]To keep the thread clean,[/B]
- Post your problem 'Variable returns nil at some point', for example.
- Post the code that you think is necessary to solve this problem.
- Post the error that you are getting. For example, '[ERROR] gamemodes/skeleton/gamemode/client/hud.lua:70'
- Media that can describe the problem better than words would help a lot in most cases.
- Wrap code tags around your code. For example,
[lua]print "codens here"[/lua]
Remember to put the lua/code tags; [noparse][lua] <code> [/lua][/noparse]
- Please do not spam your problem (when you don't get any response, it means that other people are not familliar with your problem)
[B]Reminder[/B]
- Please don't ask for help when it comes to content that isn't yours. Contact the creator instead, we don't want you're leaked content!
- Before creating a post, I suggest you have a look at some coding sources such as;
[b]Official Garry's Mod Wiki[/b]: [url=http://wiki.garrysmod.org]wiki.garrysmod.org[/url]
[b]Old Garry's Mod Wiki. Has more examples[/b]: [url=https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4875.htmll]maurits.tv (long url)[/url]
[b]Garry's Mod GitHub ( The Lua files of Garry's Mod )[/b]: [url=https://github.com/garrynewman/garrysmod]github.com/garrynewman/garrysmod[/url]
[B]Previous Threads:[/B]
[b]v1.0[/b]: [url]http://facepunch.com/showthread.php?t=1348923[/url]
[b]v2.0[/b]: [url]http://facepunch.com/showthread.php?t=1411111[/url]
Exho beat you, but your logo is better than his, so you've got that going for you
From last thread, never answered (I was the last post)
How can I get if a convar is changed and update a paint hook.
Well this is awkward
whats the command to send the viewmodel animation speed of a weapon?
I was wondering when someone was gonna make a new thread.
Repost from last thread for all you to know how much of a noob I am :)
I'm getting an error with the following code (code is clientside):[lua]
function SWEP:CreateShell(sh)
if IsValid( self.Owner ) && self.Owner:Alive() then
vm = self.Owner:GetViewModel()
att = vm:GetAttachment(2) // This is coming up NULL
[/lua]
Any ideas as to why that line would be coming up null? The players are holding a (should be) valid primary weapon. :P
[QUOTE=LUModder;47415372]From last thread, never answered (I was the last post)
How can I get if a convar is changed and update a paint hook.[/QUOTE]
I believe you have to use callbacks for them ([url]http://wiki.garrysmod.com/page/cvars/AddChangeCallback[/url]). As for updating a paint hook, it becomes tricky because you cant conditionally fun a paint hook. I mean, if you have a HUDPaint hook for example it will always get called, so you need to have some check for a value so you might need to cache the values of the convar you are tracking and check that.
[editline]29th March 2015[/editline]
Also, 2 of my posts from the old thread are still unanswers if anyone can help?
[quote]
Is there anyway to properly set bone positions? I'm trying to make it so that when people get arrested in my gamemode, their arms go behind their back (Like in real life). Apparently, ent:SetBonePosition only works in a specific hook which is also apparently broken. I need it so that when the player walks around, jumps, swims, enters a vehicle, etc their hands are still behind their back. Any ideas?
[/quote]
[quote]
I'm having a small problem with SWEPs. I'm using a (Fairly old) version of Mad Cows Weapons which was ported to GM13 after the beta, so this problem could be the weapon base. I have set all of the weapons to have a Primary.DefaultClip of 0, and when I give myself one of the guns (Without having any ammo for it), I cannot fire, right click or anything, none of the functions are being called. If I then give myself ammo, I have to switch to another weapon, then back to the weapon I want, reload, then I can shoot, etc. However, if I give myself ammo before I give myself the gun, I can reload instantly and it works how it should.
Mostly I just want to know if this is a problem with the weapon base or if someone else can verify that this is a problem with Garry's Mod.
[/quote]
If I print my UserGroup serverside it's perfectly fine and I'm superadmin, but clientside I am 'user'
Is this evolve being weird or anyone else had an issue like this?
[QUOTE=NiandraLades;47417476]If I print my UserGroup serverside it's perfectly fine and I'm superadmin, but clientside I am 'user'
Is this evolve being weird or anyone else had an issue like this?[/QUOTE]
Make sure your server is up to date.
I can't seem to set the angles of a ClientsideModel in PostPlayerDraw, I can set the position fine. Doing the same code in Think works fine with angles except position lags behind.
[code]
ang = client:GetAngles()
if pos then
model, pos, ang = data.offset( client, model, pos, ang )
model:SetPos(pos)
model:SetAngles(ang)
end
[/code]
Is there anyway to get the position of a docked panel? I have a DFrame, DLabel and DTextEntry. The DLabel and DTextEntry are both parented to the DFrame and the DLabel is docked to the top and I'm trying to position the DTextEntry to the right of the DLabel but when I try to get the position of the DLabel, I only get 0, 0. I have tried DLabel:GetPos and DFrame:GetChildPosition(DLabel) and they both return 0, 0.
[QUOTE=Ivitokun;47419511][video=youtube;zaWsLTSUcx0]http://www.youtube.com/watch?v=zaWsLTSUcx0[/video]
[lua] render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilWriteMask(255)
render.SetStencilTestMask(255)
render.SetStencilReferenceValue(15)
render.SetStencilFailOperation(STENCILOPERATION_KEEP)
render.SetStencilZFailOperation(STENCILOPERATION_KEEP)
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
render.SetBlend(0) --don't visually draw, just stencil
self:SetModelScale(1.0,0) --slightly fuzzy, looks better this way
self:DrawModel()
self:SetModelScale(1,0)
render.SetBlend(1)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
cam.Start3D2D(Pos + Ang:Up()*1 + Ang:Right()*4+ Ang:Forward() * -2, TextAng, 0.3)
//surface.SetDrawColor(255,255,255,255)
//surface.DrawRect(-ScrW(),-ScrH(),ScrW()*2,ScrH()*2)
draw.WordBox(1, -170, -22,self:GetNWString("TestText"), "Default", Color(0, 0, 0, 0), Color(0, 0, 150, 255))//Color(255,255,255,self:GetNWInt("AlphaChannel", 255)))
cam.End3D2D()
//self:DrawModel()
render.SetStencilEnable(false)[/lua][/QUOTE]
Try adding
[lua]render.SetStencilWriteMask(0)
render.SetStencilTestMask(0)[/lua] after its finished. It fixed a similar issue I was having, I've seen it or something similar mentioned before in regards to garrys halos and stencils behaving badly together.
[QUOTE=ROFLBURGER;47415465]whats the command to send the viewmodel animation speed of a weapon?[/QUOTE]
Managed to find the command but I'm having trouble with it.
I'm setting the playback rate of the viewmodel to 0.5 using this
[code]ply:GetViewModel():SetPlaybackRate(0.5)[/code]
is a serverside script
but in a shared weapon script
[code]print(self.Owner:GetViewModel():GetPlaybackRate())[/code]
its printing 1 for both client and shared
i can't seem to get SetLocalModelLights to work, killburn said it needs to be used in conjunction with SuppressEngineLighting, but the model just remains fullbright no matter what I do.
[code]local lights = { }
lights[ "light" ] = { MATERIAL_LIGHT_POINT, Color( 255, 0, 0 ), Vector( 16, 160, 72 ), Vector( 0, 0, 0 ), 0, 5, 45, 45, 1000, 10000, 0, 0, 1 }
hook.Add( "PostDrawOpaqueRenderables", "kips", function( )
render.SuppressEngineLighting( true )
render.SetLocalModelLights( lights )
for k, v in pairs( models ) do
v:DrawModel( )
end
render.SuppressEngineLighting( false )
end )
[/code]
[QUOTE=wh1t3rabbit;47420027]Try adding
[lua]render.SetStencilWriteMask(0)
render.SetStencilTestMask(0)[/lua] after its finished. It fixed a similar issue I was having, I've seen it or something similar mentioned before in regards to garrys halos and stencils behaving badly together.[/QUOTE]
thx. but I solved it
My DIconLayout should be showing icons but isn't. Pretty sure the code is right.
[code]
local iconlist = vgui.Create("DIconLayout",plyslot)
iconlist:SetPos(32,16)
iconlist:SetSize(plyslot:GetWide()-128,16)
iconlist:SetSpaceX(5)
--if ply:GetFriendStatus() == "friend" then
local icon_friend = iconlist:Add("DImage")
icon_friend:SetSize(16,16)
icon_friend:SetImage(icons.friend)
--end
[/code]
Results in
[img]http://i.imgur.com/yHXkbq0.png[/img]
[QUOTE=LUModder;47420785]My DIconLayout should be showing icons but isn't. Pretty sure the code is right.
[code]
local iconlist = vgui.Create("DIconLayout",plyslot)
iconlist:SetPos(32,16)
iconlist:SetSize(plyslot:GetWide()-128,16)
iconlist:SetSpaceX(5)
--if ply:GetFriendStatus() == "friend" then
local icon_friend = iconlist:Add("DImage")
icon_friend:SetSize(16,16)
icon_friend:SetImage(icons.friend)
--end
[/code]
Results in
[img]http://i.imgur.com/yHXkbq0.png[/img][/QUOTE]
Why are you bothering with DIconLayout if you are only adding one icon?
That panel is useful for adding large quantities of icons.
[QUOTE=Robotboy655;47420870]Why are you bothering with DIconLayout if you are only adding one icon?
That panel is useful for adding large quantities of icons.[/QUOTE]
I'm only testing it with one icon for the moment, would it work better if there was more icons?
No, you'll have to debug this yourself though ( GetSize, check parent after adding new icons, search for examples, etc ).
One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I've already scanned the server and client console for hints to the reason why but have no idea, and no it doesn't use NWVars :P
Thanks!
[QUOTE=YourStalker;47421269]One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I've already scanned the server and client console for hints to the reason why but have no idea, and no it doesn't use NWVars :P
Thanks![/QUOTE]
Well... there's not much we can figure out without actually seeing the addon, or being given an idea of what it does and how you do it.
[QUOTE=YourStalker;47421269]One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I've already scanned the server and client console for hints to the reason why but have no idea, and no it doesn't use NWVars :P
Thanks![/QUOTE]
This question has literally been asked a billion times and every single time its the same answer: Disable ALL of your addons then re-enable them one by one until your server crashes.
[QUOTE=G4MB!T;47421302]This question has literally been asked a billion times and every single time its the same answer: Disable ALL of your addons then re-enable them one by one until your server crashes.[/QUOTE]
He knows what add-on it is.
Oh whoops, misread it. Well if you know which it is, contact the author and get them to sort it out?
[QUOTE=YourStalker;47421269]One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I've already scanned the server and client console for hints to the reason why but have no idea, and no it doesn't use NWVars :P
Thanks![/QUOTE]
Tbh in that case i would ask on facepunch. With as much possible informations regarding your server to create an live near working environment to test the addon.
Maybe it isnt the addon itself, maybe it collides with an another addon.
[QUOTE=YourStalker;47421269]One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I've already scanned the server and client console for hints to the reason why but have no idea, and no it doesn't use NWVars :P
Thanks![/QUOTE]
Which addon is it? I'm asking in case the answer could help someone else.
Is there any way to tell if the server has crashed or closed improperly server-side? GM:ShutDown seems to only work when the server is terminated safely, and I'm looking for a way to dump/save data without losing it.
This isn't as much of an error as much as it is a question. I'm looking into reading files that contain model locations. My question is how should I read the file that's located in the gamemode's folder?
[QUOTE=Z61;47421641]This isn't as much of an error as much as it is a question. I'm looking into reading files that contain model locations. My question is how should I read the file that's located in the gamemode's folder?[/QUOTE]
file.Read("gamemodes/file.txt", "GAME")?
Sorry, you need to Log In to post a reply to this thread.