• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=P4sca1;49000782]Is there a hook that is called, when C4 gets disarmed?[/QUOTE] Overwrite [URL="https://github.com/garrynewman/garrysmod/blob/3e138636eb1b0ad6ed785dedf350020755cff5f1/garrysmod/gamemodes/terrortown/gamemode/scoring.lua#L123"]SCORE:HandleC4Disarm[/URL] with the same code, but with whatever "hook" code you want. [editline]28th October 2015[/editline] [QUOTE=Z0mb1n3;48999406]Is there a reason this does not work? Inside the init of an html panel, I have [code] self:AddFunction("prop", "realwidth", function(str) self:SetRealWidth(tonumber(str)) print(self:GetRealWidth()) end) [/code] and when I run the javascript function, it works fine, but if I try to print that value any other time, it doesn't exist, example: I run the javascript, and the callback prints the value. I use the accessor function I created and try printing the value of RealWidth and it returns nil. Is it asynchronous and I'm being dumb? [editline]28th October 2015[/editline] Yes I guess it is asynchronous, sorry.[/QUOTE] Looking at your last few posts, you can get the width and height from JavaScript using window.outerHeight and window.outerWidth. [URL="http://www.w3schools.com/jsref/prop_win_outerheight.asp"]W3Schools (ew, I know)[/URL] [editline]28th October 2015[/editline] [QUOTE=Becomeimp;48996443]What can cause a file like "lua/autorun/something_example.lua" to run fine in single player but not run in a multiplayer/online server? I used "AddCSLuaFile()" in a combination of ways but non seem to be fixing it. Is there anything else I can check?[/QUOTE] Any file placed in lua/autorun/ and NOT lua/autorun/server will execute on the client. You do not need to add AddCSLuaFile for files in the directory. Are you sure there are no errors, the file is not empty and the file actually exists?
[QUOTE=BillyOnWiiU;49001292] Looking at your last few posts, you can get the width and height from JavaScript using window.outerHeight and window.outerWidth. [URL="http://www.w3schools.com/jsref/prop_win_outerheight.asp"]W3Schools (ew, I know)[/URL] [/QUOTE] Well I've got the width and height correct, but the problem is I made a custom SizeToContents function for these panels, and the unfortunate thing is that it runs javascript to retrieve the width of the icons. Unfortunate because it takes about 0.12 seconds for the javascript to run and resize the panel, at which point garry's mod still thinks the panel's boundaries are 64 x 24, because GetSize returns a value before the sizing is run by the javascript.
There used to be an old module that would change the information that player entities (and other entities) would transmit. I believe it was a part of the Sassilization stuff. Does anyone have the source to that module (from the Sassilization release maybe?) or know how you could even mess with that in a module?
I want to insert a newline into a string every x characters, what method should I use for this? Like, I can explain what I want but looking at the wiki, can't figure out what to use for this Thanks!
[QUOTE=NiandraLades;49001698]I want to insert a newline into a string every x characters, what method should I use for this? Like, I can explain what I want but looking at the wiki, can't figure out what to use for this Thanks![/QUOTE] You can use string.Explode, loop through the table, and when the key % x is 0, table.insert a newline at that position, and table.concat when you're finished. You can also just use the string library, using a loop, the # operator and string.sub.
Maybe I'm just pulling a dumb here or my memory is failing me, but I thought when ENT.Base was set to another entity the child entity would then inherit that entities functions and so on via the ENT table. Or am I totally wrong?
[QUOTE=man with hat;49001825]You can use string.Explode, loop through the table, and when the key % x is 0, table.insert a newline at that position, and table.concat when you're finished. You can also just use the string library, using a loop, the # operator and string.sub.[/QUOTE] [lua] local pattern = string.format('(%s)', string.rep('[^\n]', amt)) string.gsub(str, pattern, '%1\n') [/lua]
Anyone know why Atmos wont work with maps on a dedicated server? I'm trying to get it working with rockford, it works fine in singleplayer but I get the default skybox with clouds and the dnc cycle wont work when on a dedicated server. No errors relating to this in the console. Thanks.
So I'm trying my hand at making some more VGUI, and in the style of material design, as I wanted to make my own base for it, but when testing a way for the button tap animation to draw, if the circle extends beyond the bottom-right corner of the button, a segment's alpha will reset. [video=youtube_share;rlzLGyWqFYA]http://youtu.be/rlzLGyWqFYA[/video] Here is the code for it, in case you want to test it and/or tell me there is a better way to do this. [code] function draw.Circle( x, y, radius, seg ) local cir = {} table.insert( cir, { x = x, y = y, u = 0.5, v = 0.5 } ) for i = 0, seg do local a = math.rad( ( i / seg ) * -360 ) table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) end local a = math.rad( 0 ) -- This is need for non absolute segment counts table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) surface.DrawPoly( cir ) end if button then button:Remove() button = nil end surface.CreateFont("robomed", {font = "Roboto-Medium", antialias = true, size = ScreenScale(9), weight = 500}) button = vgui.Create("DButton") button:SetFont("robomed") button:SetText("Shitty button") button:SetSize(400, 500) button:Center() button.color = color_white --button.bubblecolor = Color(button.color.r-50, button.color.g-50, button.color.b-50, button.color.a-50) button.bubblecolor = color_black button.Paint = function(but, w, h) surface.SetDrawColor(but.highlighted and but.highlightcolor or but.color) surface.DrawRect(0, 0, w, h) if button.bubble then surface.SetDrawColor(button.bubblecolor.r, button.bubblecolor.g, button.bubblecolor.b, button.bubblealpha) draw.Circle(button.bubblex, button.bubbley, button.bubbleradius, 150) --surface.DrawCircle(but.bubblex, but.bubbley, but.bubbleradius, ColorAlpha(but.bubblecolor, but.bubblealpha)) end end button.Think = function(bu) if button.bubble then button.bubbleradius = (button.bubbleradius or 1)+5 button.bubblealpha = math.Clamp((button.bubblealpha or button.bubblecolor.a)-10, 0, 255) if button.bubblealpha <= 0 then button.bubble = false end end end function button:OnCursorEntered() local h,s,v = ColorToHSV(self.bubblecolor) local highlight = HSVToColor(h, s*0.5, v*0.5) self.highlighted = true self.highlightcol = highlight end button.DoClick = function(bu) bu.bubble = true local x,y = bu:GetPos() bu.bubblex = gui.MouseX() - x bu.bubbley = gui.MouseY() - y button.bubbleradius = 0 button.bubblealpha = 255 end [/code]
Can you include fonts (.ttf) in a workshop addon? I recall at some point it wasn't possible - or didn't work.
[QUOTE=ms333;49003179]Can you include fonts (.ttf) in a workshop addon? I recall at some point it wasn't possible - or didn't work.[/QUOTE] No. It doesn't work, but I heard it will be fixed at sometime.
[QUOTE=Z0mb1n3;49002321]:snip:[/QUOTE] I think putting this before the surface.DrawPoly might solve your issue: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/NoTexture]draw.NoTexture[/url]
Is there anyway to freeze the playermodel moving animation in DModelPanel? [IMG]https://i.gyazo.com/3d900825209c000dd79d982e47f2a0e8.gif[/IMG]
[QUOTE=geferon;49004684]I think putting this before the surface.DrawPoly might solve your issue: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/NoTexture]draw.NoTexture[/url][/QUOTE] Tried, doesn't seem to do anything.
[QUOTE=kpjVideo;49004793]Is there anyway to freeze the playermodel moving animation in DModelPanel?[/QUOTE] Parent the clientside model to the model in the DModelPanel somehow. I dunno how PAC does it when you render a PAC inside a DModelPanel, so try looking there.
Sorry, but could I please get an answer for this? (I [URL="https://forums.coronalabs.com/topic/38127-how-to-call-a-function-from-another-lua-file/"]found a solution[/URL] to my previous question): [QUOTE=MPan1;48991790]What if I wanted to add 1 to the number instead? I tried [CODE] value = math.min( max, value + RealFrameTime() / 1 ) -- I want it to take a second if value == max then value = 0 end [/CODE] But it went really slow and took more than a second. [/QUOTE] ^^ Don't know the answer for this [editline]29th October 2015[/editline] Also, I just noticed something- when I try to create a new post, a big 'YOU ARE GOING TO GET BANNED' banner comes over the top of it. Why? What did I do? I checked the ban list and my name wasn't even on it, and my name isn't shown in red?!
[QUOTE=BillyOnWiiU;49001292] Any file placed in lua/autorun/ and NOT lua/autorun/server will execute on the client. You do not need to add AddCSLuaFile for files in the directory. Are you sure there are no errors, the file is not empty and the file actually exists?[/QUOTE] Its actually serverside stuff, so will putting it in lua/autorun/server actually fix this? (its just in lua/autorun/ currently)
[QUOTE=Becomeimp;49006626]Its actually serverside stuff, so will putting it in lua/autorun/server actually fix this? (its just in lua/autorun/ currently)[/QUOTE] SMOKE WEED CALM DOWN YOU STIFF ASS NERRRGERERRRR BLACK MANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN00000000000016©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©BUMPE SERROTTOOTO SEVERRRRRREWWWWWWWWWASA GUUSSSS BBBBBOWWWWWWWNMMM BEWM
[QUOTE=MPan1;49006390] Also, I just noticed something- when I try to create a new post, a big 'YOU ARE GOING TO GET BANNED' banner comes over the top of it. Why? What did I do? I checked the ban list and my name wasn't even on it, and my name isn't shown in red?![/QUOTE] I think its for everyone, you can disable it in settings.
[QUOTE=MPan1;49006390]Sorry, but could I please get an answer for this? [CODE] value = math.min( max, value + RealFrameTime() / 1 ) -- I want it to take a second if value == max then value = 0 end [/CODE] [/QUOTE] Maybe I'm just being stupid, but what is max? Is it just some arbitrary number?
In my case it's 20 (but I want it to be any number) I just want a number to go from 0-20 then back to 0 and to 20 again forever, but since it's in a panel:Paint() hook, I don't want it going too fast depending on the user's computer speed.
Does entity/SetSequence not work on players..? Im not getting an error when i try to do it but it doesnt force the animation..Im using npc model on nutscript so it should be working.. -edit Sigh..gotta use forceSequence
[QUOTE=MPan1;49006390]Sorry, but could I please get an answer for this? [CODE]value = math.min( max, value + RealFrameTime() / 1 ) -- I want it to take a second if value == max then value = 0 end[/CODE][/QUOTE] Well the original code that Kogitsune gave you doesn't work for me either, so I'm not sure. [editline]30th October 2015[/editline] Okay, I got it to work: [CODE]value = math.min( max, value + ( max / seconds ) / ( 1 / RealFrameTime() ) ) if value == max then value = 0 end [/CODE] I'm fairly certain the ugly fractions in a fraction can be simplified, but I'm not good at math so I'm not sure how to do that.
value = math.min( max, value + ( max * RealFrameTime() / seconds ) )
Anyone have any idea why input.IsMouseDown or any variation doesn't work with the scroll wheel? [code] if input.IsMouseDown( MOUSE_WHEEL_UP ) then number = number + 1 elseif input.IsMouseDown( MOUSE_WHEEL_DOWN ) then number = number - 1 end [/code] for example, doesn't do a thing in THINK [editline]fuckyou[/editline] Found a work around using BindPress but it doesn't work with screenclicker enabled. just a heads up to anyone that wanted to do something like that
How do I have some playermodel bones hidden without affecting bonemerged models ? Using ENT:ManipulateBoneScale and zero vector affects bonemerged models also.
Hey guys, How would one go about hiding or making invisible the world and view models for a step? I'm making a small knife for prop hunt props to use on glass windows that doesn't damage players and the hands holding the knife don't look good at all so I just wanna get rid of the model and have it be an invisible glass breaker. Thanks for the help, -Kyle
[IMG]https://i.gyazo.com/63a98f271deb3c98d8e73cabcd6a4de1.png[/IMG] Why is my NPC stuck like this o-o [CODE]AddCSLuaFile() ENT.Type = "anim" ENT.PrintName = "Citizen" ENT.Author = "Damien" ENT.Spawnable = true ENT.Category = "NutScript" if SERVER then ENT.hasID=true ENT.firstname=nil ENT.lastname=nil ENT.dob=nil ENT.height=nil ENT.weight=nil ENT.shirttype=nil ENT.shirtcolor=nil ENT.pantstype=nil ENT.pantscolor=nil ENT.hattype=nil ENT.hatcolor=nil ENT.race=nil ENT.eyecolor=nil ENT.haircolor=nil ENT.info=nil ENT.secondInfo=nil end function ENT:Initialize() if (SERVER) then self.lastname = lastnames[math.random(1,#lastnames)] self.firstname = firstnames[math.random(1,#firstnames)] self.dob = math.random(minDOB,maxDOB) self.expireday = math.random(1,30) self.expiremonth = math.random(1,12) self.expireyear = math.random(2014,2020) self.issueday = math.random(1,30) self.issuemonth = math.random(1,12) self.issueyear = math.random(2000,2015) self.height = math.random(minHeight,maxHeight) self.weight = math.random(minWeight,maxWeight) self.gender = genders[math.random(1,#genders)] if(self.gender=="Female")then self.race = races[math.random(1,#races)] if(self.race=="Black")then self.clothesmodel= clothesmodelMales[1][math.random(1,#clothesmodelMales[1])][1] self.clothesdesc= clothesmodelMales[1][math.random(1,#clothesmodelMales[1])][2] elseif(self.race=="Asian")then self.clothesmodel= clothesmodelMales[1][math.random(1,#clothesmodelMales[2])][1] self.clothesdesc= clothesmodelMales[1][math.random(1,#clothesmodelMales[2])][2] elseif(self.race=="White")then self.clothesmodel= clothesmodelMales[1][math.random(1,#clothesmodelMales[3])][1] self.clothesdesc= clothesmodelMales[1][math.random(1,#clothesmodelMales[3])][2] end elseif(self.gender=="Male")then self.race = races[math.random(1,#races)] if(self.race=="Black")then self.clothesmodel= clothesmodelMales[1][math.random(1,#clothesmodelMales[1])][1] self.clothesdesc= clothesmodelMales[1][math.random(1,#clothesmodelMales[1])][2] elseif(self.race=="Asian")then self.clothesmodel= clothesmodelMales[2][math.random(1,#clothesmodelMales[2])][1] self.clothesdesc= clothesmodelMales[2][math.random(1,#clothesmodelMales[2])][2] elseif(self.race=="White")then self.clothesmodel= clothesmodelMales[3][math.random(1,#clothesmodelMales[3])][1] self.clothesdesc= clothesmodelMales[3][math.random(1,#clothesmodelMales[3])][2] end end local issuestring = self.expiremonth.."-"..self.expireday.."-"..self.expireyear local expirestring = self.issuemonth.."-"..self.issueday.."-"..self.issueyear self.eyecolor = eyeColors[math.random(1,#eyeColors)] self.haircolor = hairColors[math.random(1,#hairColors)] -- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 self.info={self.firstname,self.lastname,self.dob,issuestring,expirestring,self.race,self.gender,2015-self.dob,self.eyecolor,self.height} self.secondInfo={self.weight,self.haircolor,self.clothesdesc,self} self:SetModel(self.clothesmodel) self:SetUseType(SIMPLE_USE) self:SetMoveType(MOVETYPE_NONE) self:DrawShadow(true) self:SetSolid( SOLID_VPHYSICS ) self:PhysicsInit(SOLID_BBOX) if (IsValid(physicsObject)) then physicsObject:EnableMotion(false) physicsObject:Sleep() end else end timer.Simple(1, function() if (IsValid(self)) then for k, v in pairs(self:GetSequenceList()) do if (string.find(string.lower(v), "idle")) then if (v != "idlenoise") then self:ResetSequence(k) return end end end self:ResetSequence(4) end end) end if (CLIENT) then function ENT:Think() self:SetEyeTarget(LocalPlayer():GetPos()) end function ENT:Draw() self:DrawModel() end function ENT:OnRemove() end else function ENT:Use(activator) if(activator:GetNWBool("actionMenuOpen"))then else activator:SetNWBool("actionMenuOpen",true) activator:SetNWEntity("npcInteractingWith",self) activator:SetNWString("npcInfoTable",util.TableToJSON(self.info)) activator:SetNWString("secondNpcInfoTable",util.TableToJSON(self.secondInfo)) net.Start( "openActionMenuHook" ) net.WriteTable(self.info) net.Send( activator ) end end end[/CODE]
Sorry for not answering the question above, but: Is there a way to make a DButton auto-resize to it's text? [editline]31st October 2015[/editline] Or create a DPanel that is sized to a DLabel with SetWrap enabled parented and Dock(FILL)'d to it?
Hey, I have a problem with my FastDL. The FastDL is working just fine, but with just this one file, it is giving this error upon joining: HTTP ERROR 8 downloading [url]http://fastdl.einfach-gmod.de/sound/vehicles/tdmcars/scania/third.wav.bz2[/url] Normally this error appeared, when the file is not existend, but this time, the file exists and can be downloaded through my browser. Any idea? :/
Sorry, you need to Log In to post a reply to this thread.