• What do you need help with? V3
    6,419 replies, posted
Brandon, look around in this thread. I posted a simple fix for that many pages back. If you find it, cool cool, else I will post it tomorrow when I get on my PC.
[QUOTE=brandonj4;38948960]You're not on steam? Last attempt: [lua] local ItemPanel = vgui.Create("ItemModelPanel") ItemPanel:SetModel(item.Model) ItemPanel:SetSize(150,120) ItemPanel.PaintOrig = ItemPanel.Paint ItemPanel.Parent = ItemPanel:GetParent() function ItemPanel.Paint(self, w, h) local x, y = gui.MousePos() LocalPlayer():ChatPrint(x.."-"..y) render.SetScissorRect(x, y, ScrW(), ScrH(), true) self.PaintOrig(self) render.SetScissorRect(0, 0, 0, 0, false) end [/lua] Doesn't seem to affect the models.[/QUOTE] I think you're missing the point of render.SetScissorRect (that code makes no sense), the four number arguments define a rectangle, nothing will draw outside this rectangle until the scissor is disabled. It's like drawing a picture, then taking a piece of paper, cutting a square out of it then putting the hole over the picture. The co-ordinates render.SetScissorRect takes are always relative to the screens origin, so you'll have to translate any co-ordinates to use them inside panel paint functions. [lua] local ItemPanel = vgui.Create("ItemModelPanel") ItemPanel:SetModel(item.Model) ItemPanel:SetSize(150,120) ItemPanel.PaintOrig = ItemPanel.Paint ItemPanel.Parent = ItemPanel:GetParent() function ItemPanel.Paint(self, w, h) local x, y = ItemPanel:LocalToScreen() LocalPlayer():ChatPrint(x.."-"..y) render.SetScissorRect(x, y, x + w, y + w, true) self.PaintOrig(self) render.SetScissorRect(0, 0, 0, 0, false) end [/lua]
[QUOTE=DarthTealc;38949251]Is it possible with Lua to make a "player clip" wall? In hammer you just make a wall and put the "player clip" material on it but I can't seem to do anything like that in Lua. By "player clip" I mean everything can pass through except the player. Bullets, props, whatever, they all go through. But not the player. I've tried a variety of different entity types but haven't managed to figure it out.[/QUOTE] Use a brush SENT w/ GM:ShouldCollide?
[QUOTE=Drakehawke;38949247]I think you're missing the point of render.SetScissorRect (that code makes no sense), the four number arguments define a rectangle, nothing will draw outside this rectangle until the scissor is disabled. It's like drawing a picture, then taking a piece of paper, cutting a square out of it then putting the hole over the picture. The co-ordinates render.SetScissorRect takes are always relative to the screens origin, so you'll have to translate any co-ordinates to use them inside panel paint functions. [lua] local ItemPanel = vgui.Create("ItemModelPanel") ItemPanel:SetModel(item.Model) ItemPanel:SetSize(150,120) ItemPanel.PaintOrig = ItemPanel.Paint ItemPanel.Parent = ItemPanel:GetParent() function ItemPanel.Paint(self, w, h) local x, y = ItemPanel:LocalToScreen() LocalPlayer():ChatPrint(x.."-"..y) render.SetScissorRect(x, y, x + w, y + w, true) self.PaintOrig(self) render.SetScissorRect(0, 0, 0, 0, false) end [/lua][/QUOTE] I have done that and it doesn't affect the DModelPanel's model, it only affects the paint being draw behind it. Crap-Head I found your fix and it's the exact same as _Undefined's code. No solution.
[QUOTE=brandonj4;38949311]I have done that and it doesn't affect the DModelPanel's model, it only affects the paint being draw behind it. Crap-Head I found your fix and it's the exact same as _Undefined's code. No solution.[/QUOTE] So override the actual DModelPanel's Paint instead? [lua]dmodelpanel.OldPaint = dmodelpanel.Paint function dmodelpanel:Paint() local x, y = self:LocalToScreen() render.SetScissorRect( x, y, x + self:GetWide(), y + self:GetTall(), true ) self:OldPaint() render.SetScissorRect( 0, 0, 0, 0, false ) end [/lua]
[QUOTE=Drakehawke;38949344]So override the actual DModelPanel's Paint instead? [lua]dmodelpanel.OldPaint = dmodelpanel.Paint function dmodelpanel:Paint() local x, y = self:LocalToScreen() render.SetScissorRect( x, y, x + self:GetWide(), y + self:GetTall(), true ) self:OldPaint() render.SetScissorRect( 0, 0, 0, 0, false ) end [/lua][/QUOTE] I have done that already.. It still draws the model in place. I don't know what's left to try and do.
[QUOTE=brandonj4;38949405]I have done that already.. It still draws the model in place. I don't know what's left to try and do.[/QUOTE] [url]http://pastebin.com/QV6feRZz[/url] This is something I found lying around, I have it working but it may be rather bad. I've no idea who originally made it.
[QUOTE=Willox;38949427][url]http://pastebin.com/QV6feRZz[/url] This is something I found lying around, I have it working but it may be rather bad. I've no idea who originally made it.[/QUOTE] You have just made my day. Thank you!
-snip oh-
[QUOTE=Drakehawke;38949472]Am I correct in thinking you're trying to stop the whole model from drawing even if just part of the panel is visible? (sorry I joined in late)[/QUOTE] No I wanted it to do what Panel.NoClipping did in the DPanelList, but I didn't in anyway have it in the right order that willox's paste had. I realize my mistake now in the snippet that was posted before but thanks Willox for posting the whole script.
Which part of a gamemodes folder do effects go in?
[QUOTE=Drakehawke;38950462]Which part of a gamemodes folder do effects go in?[/QUOTE] gamemode/entities/effects/?
Using surface.DrawTexturedRect and a png file, how can I disable the image filtering?
[QUOTE=vexx21322;38951666]Using surface.DrawTexturedRect and a png file, how can I disable the image filtering?[/QUOTE] Use a VTF instead? I'm unsure if the surface library even has a filtering function.
[QUOTE=Magenta;38951734]Use a VTF instead? :v:[/QUOTE] Yeah, I just found out that pngs are always filtered. Must be the way they are loaded.
[QUOTE=vexx21322;38951737]Yeah, I just found out that pngs are always filtered. Must be the way they are loaded.[/QUOTE] Damn, Sorry to hear that, Good luck though.
I am attempting to update a message at the bottom of the hud from a random table of strings. I just cant seem to figure this out :/ Any help?
[QUOTE=RattSplat;38954744]I am attempting to update a message at the bottom of the hud from a random table of strings. I just cant seem to figure this out :/ Any help?[/QUOTE] Figure out what ? Choosing random text off the table ?
[QUOTE=RattSplat;38954744]I am attempting to update a message at the bottom of the hud from a random table of strings. I just cant seem to figure this out :/ Any help?[/QUOTE] LocalPlayer().StringV = table.Random(MyStrings) draw.SimpleText( LocalPlayer().StringV, whatever, so, on, so, forth )
[QUOTE=Magenta;38954895]LocalPlayer().StringV = table.Random(MyStrings) draw.SimpleText( LocalPlayer().StringV, whatever, so, on, so, forth )[/QUOTE] Thank you very much! Now, yes this displays the string properly oppose to how it was spitting out strings without stopping, I'd like it to continue to change the string selected at an interval. I have tried creating a timer for this but I don't adsafsfswdas... :v:
Could anyone help me add chat commands to [url]http://facepunch.com/showthread.php?t=1228438&p=38955329#post38955329[/url] so users can use !shop to access
[QUOTE=RattSplat;38954982]Thank you very much! Now, yes this displays the string properly oppose to how it was spitting out strings without stopping, I'd like it to continue to change the string selected at an interval. I have tried creating a timer for this but I don't adsafsfswdas... :v:[/QUOTE] timer.Create( "HOLYSHIT", 30, 0, function() -- 30 secondz LocalPlayer().StringV = table.Random(TheStroooooongs) end)
I am really bad at making weapons, I never made any. Can anyone tell me why does this: [lua]function SWEP:Deploy() self:SendWeaponAnim( ACT_VM_DRAW ) end function SWEP:PrimaryAttack() self:SetNextPrimaryFire(CurTime()+4) self:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) timer.Simple(4, self.Deploy ) end[/lua] Outputs: Attempt to index local "self" a nil value ?
[QUOTE=Netheous;38955665]I am really bad at making weapons, I never made any. Can anyone tell me why does this: [lua]function SWEP:Deploy() self:SendWeaponAnim( ACT_VM_DRAW ) end function SWEP:PrimaryAttack() self:SetNextPrimaryFire(CurTime()+4) self:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) timer.Simple(4, self.Deploy ) end[/lua] Outputs: Attempt to index local "self" a nil value ?[/QUOTE] You need to pass the weapon object too [lua]timer.Simple(4, function() self:Deploy() end)[/lua]
[QUOTE=Drakehawke;38955694]You need to pass the weapon object too [lua]timer.Simple(4, function() self:Deploy() end)[/lua][/QUOTE] Oh me silly, this is what happens when you try to work at 3 AM
[QUOTE=Netheous;38955945]Oh me silly, this is what happens when you try to work at 3 AM[/QUOTE] Ha, you and me both. [QUOTE=Magenta;38955607]timer.Create( "HOLYSHIT", 30, 0, function() -- 30 secondz LocalPlayer().StringV = table.Random(TheStroooooongs) end)[/QUOTE] Now it seems the hud is attempting to call the string before the timer finds the string. :v: Update: Fixed. [lua] draw.SimpleText( text2 or blank, "HudFont1", fx2 + 2, fy + 2, Color(25, 25, 25, 115), TEXT_ALIGN_LEFT ) [/lua] Where "blank" is an empty string.
@Edit: Nevermind then
Could anyone help me add chat commands to [url]http://facepunch.com/showthread.php?t=1228438&p=38955329#post38955329[/url] so users can use !shop to access
Hey guys, I currently have a server with Xenon and they let you have Fast DL. So anyway the reason I'm telling you this is because when I try to force users to download the textures for The Stalker gamemode it doesn't work and they end up missing some important ones. This is the code I'm using: [CODE]local ClientResources = 0; local function ProcessFolder ( Location ) for k, v in pairs(file.Find(Location .. '*')) do if !string.find(Location, ".svn") then if file.IsDir(Location .. v) then ProcessFolder(Location .. v .. '/') else local OurLocation = string.gsub(Location .. v, '../gamemodes/' .. GM.Path .. '/content/', '') if !string.find(Location, '.db') then ClientResources = ClientResources + 1; resource.AddFile(OurLocation); end end end end end GM.Path = "/gamemodes/stalker"; if !SinglePlayer() then ProcessFolder('../gamemodes/' .. GM.Path .. '/content/models/'); ProcessFolder('../gamemodes/' .. GM.Path .. '/content/materials/'); ProcessFolder('../gamemodes/' .. GM.Path .. '/content/sound/'); end[/CODE]\ This is in /lua/autorun/server. Any idea what I'm doing wrong?
../gamemodes/gamemodes/stalker/content/models/ isn't a valid directory. resource.AddFile has to have an argument in the form of models/. materials/. etc.
Sorry, you need to Log In to post a reply to this thread.