• What do you need help with? V3
    6,419 replies, posted
Hey guys, I wish to make my own SWEP (I have never made one before, but I am determined), using a grenade model (for now) which functions like a grenade, but on spawning/throwing, it emits a sound. Problem is, I looked at the wiki for help on this, but it didn't work (is it outdated?). What do I need in the lua file to start off? EDIT: I did try doing addon.txt in the folder, which didn't do anything
Should I be using SetScissorRect or DrawTexturedRectUV for drawing half of a texture?
snip
-snip- found the problem.
[QUOTE=Mr.D.M.C;38402783]Hello, I need help with this: [ERROR] addons/ev/lua/ev_menu/tab_players_controls.lua:72: bad argument #1 to 'pairs' (table expected, got nil) 1. pairs - [C]:-1 2. unknown - addons/ev/lua/ev_menu/tab_players_controls.lua:72 Code: If you could help. Thank you.[/QUOTE] 'self.SelectedItems' on line 21 is nil.
[QUOTE=Nexus435;38402162]Should I be using SetScissorRect or DrawTexturedRectUV for drawing half of a texture?[/QUOTE] DrawTexturedRectUV
[QUOTE=Nexus435;38402926]'self.SelectedItems' on line 21 is nil.[/QUOTE] Still can't find how to fix it.
[QUOTE=LuckyLuke;38399362]Is there a method to find a weapon's maximum ammo capacity for one clip? Or will I have to write a table with each individual weapon's max ammo and do it that way?[/QUOTE] LocalPlayer():GetActiveWeapon().Primary.ClipSize?
Any ideas what this means? Couldn't write type 6L 11/11/2012 - 07:01:47: Lua Error: Couldn't write type 6 Couldn't write type 6L 11/11/2012 - 07:01:47: Lua Error: Couldn't write type 6 Couldn't write type 6L 11/11/2012 - 07:01:47: Lua Error: Couldn't write type 6 im totally puzzled by it
[QUOTE=Drakehawke;38402995]DrawTexturedRectUV[/QUOTE] I assume I have to set the size proportional to the UV coords so it doesn't stretch out, correct?
Is it possible to stream a sound (from youtube) with hidden html panels or something, rather than forcing a client to download the sound?
Why is it that this swep now is completely broke? I've tried looking into it but I don't understand it. [lua] local vectur = Vector(0, ply:GetAngles().y, 0) turret:SetAngles(vectur) turret:PhysWake() turret:SetHealth(400) local phys = turret:GetPhysicsObject() self:Remove() [/lua] The problem I am having is that the turret isn't facing where the player is, somehow SetAngles broke. Did it change? Not only that, whenever the weapon is used self:Remove() isn't happening. The full file is here [url]https://dl.dropbox.com/u/34091117/shared.lua[/url]
[QUOTE=Dark Slayre;38403086]LocalPlayer():GetActiveWeapon().Primary.ClipSize?[/QUOTE] Just returns an error: [code] [ERROR] gamemodes/testing/gamemode/cl_init.lua:129: attempt to index field 'Primary' (a nil value) 1. GetAmmo - gamemodes/testing/gamemode/cl_init.lua:129 2. DrawWeapInfo - gamemodes/testing/gamemode/cl_init.lua:136 3. v - gamemodes/testing/gamemode/cl_init.lua:144 4. unknown - lua/includes/modules/hook.lua:75 [/code]
If I pass a player object to a metatable "constructor", will that object update if I run its methods later on? Or will it just be a copy of the object at runtime?
Hello, Im making a HUD for my Roleplay server, but i have a question that needs to be solved. I made a DmodelPanel like seen on the wiki: [url]http://wiki.garrysmod.com/page/VGUI/...ts/DModelPanel[/url] But i was wondering how i can make the background transparent instead of white. Thank you in advance.
[QUOTE=DJarthas;38407740]Hello, Im making a HUD for my Roleplay server, but i have a question that needs to be solved. I made a DmodelPanel like seen on the wiki: [url]http://wiki.garrysmod.com/page/VGUI/...ts/DModelPanel[/url] But i was wondering how i can make the background transparent instead of white. Thank you in advance.[/QUOTE] You don't need to have the modelpanel parented to a dpanel, if you leave off the first 3 lines of the example code and change [lua]vgui.Create( "DModelPanel", Panel )[/lua] to [lua]vgui.Create( "DModelPanel")[/lua] it'll stand by itself and be transparent. Remember not to constantly call this in your HUDPaint hook, though - it'll lag everyone out after about 30 seconds and look very strange if the panels are animating.
I've been trying to make players not hurt players of their own team by this piece of code: [lua]function GM:EntityTakeDamage( ent, dmginfo ) if ent:IsPlayer() and dmginfo:IsPlayer() then if ent:Team() == dmginfo:Team() then dmginfo:ScaleDamage( 0 ) end end return self.BaseClass:EntityTakeDamage( ent, dmginfo ) end [/lua] But, it's giving me this error: [code] [ERROR] gamemodes/gdr/gamemode/init.lua:102: attempt to call method 'IsPlayer' (a nil value) 1. unknown - gamemodes/gdr/gamemode/init.lua:102 [/code] It seems that dmginfo can't be seen as a player entity or something, but I have no idea how to fix this, any help?
[QUOTE=jmazouri;38407750]You don't need to have the modelpanel parented to a dpanel, if you leave off the first 3 lines of the example code and change [lua]vgui.Create( "DModelPanel", Panel )[/lua] to [lua]vgui.Create( "DModelPanel")[/lua] it'll stand by itself and be transparent. Remember not to constantly call this in your HUDPaint hook, though - it'll lag everyone out after about 30 seconds and look very strange if the panels are animating.[/QUOTE] Thanks for the help. But is there a way i can prevent that. When the player changes playermodel the DModelPanel dosent change. Im very thankfull for you're help.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9c3b.html"]CTakeDamageInfo[/URL] dmginfo:GetAttacker():IsPlayer() dmginfo is userdata, a form of information.
Ah, thanks, it works now.
what would be the best way to simulate the effect of a tree failling? like as the player hits a tree you can see how you start cutting the tree and after an amount of hits half of the tree would get cutted and turned into a physics object while the root would stay in its place so far what i have: after an amount of hits half of the tree gets turned into a phys object and i apply some impulse to it so it looks like it is falling down the root and the tree itself are different models/entities tough
Does anyone know running console commands as a mean of networking will be expensive? I'm talking about like once every button press here.
Trying to get a halo around the player's viewmodel without extreme FPS lag or overflow of render.PopFlashlightMode. Any suggestions?
[QUOTE=Chessnut;38412732]Does anyone know running console commands as a mean of networking will be expensive? I'm talking about like once every button press here.[/QUOTE] Why not use net?
Does [lua]render.PushFilterMin( TEXFILTER.ANISOTROPIC ); render.PushFilterMag( TEXFILTER.ANISOTROPIC );[/lua] only work on render draw functions? It seems to have no effect on my draw.DrawText in a 3d2d cam..
[QUOTE=CherryJim;38414075]Does [lua]render.PushFilterMin( TEXFILTER.ANISOTROPIC ); render.PushFilterMag( TEXFILTER.ANISOTROPIC );[/lua] only work on render draw functions? It seems to have no effect on my draw.DrawText in a 3d2d cam..[/QUOTE] It should work, post the full code
[lua] cam.Start3D2D( pos, camangle, .25 ) render.PushFilterMin(TEXFILTER.ANISOTROPIC) render.PushFilterMag(TEXFILTER.ANISOTROPIC) local curheight = 0 for k, v in pairs(lines) do local fontcolor = Color(v.r, v.g, v.b, v.a) draw.DrawText(v.text, "CV"..v.size, 0, -(totheight/2)+curheight, fontcolor, TEXT_ALIGN_CENTER) curheight = curheight + v.theight end render.PopFilterMin() render.PopFilterMag() cam.End3D2D() [/lua] Inside my ENT.Draw Without the filter: [t]http://puu.sh/1pc3j[/t] With: [t]http://puu.sh/1pcmV[/t] If you need any more code, let me know. This is sitting on top of an invisible PHX plate.
You're only supposed to use one - not both. You're shrinking the contents so you should be using Push/PopFilterMin.
[QUOTE=Drakehawke;38414617]You're only supposed to use one - not both. You're shrinking the contents so you should be using Push/PopFilterMin.[/QUOTE] With Min: [t]http://puu.sh/1pd78[/t] With Mag: [t]http://puu.sh/1pd7W[/t] I can't see a difference? [lua]cam.Start3D2D( pos, camangle, .25 ) render.PushFilterMin(TEXFILTER.ANISOTROPIC) local curheight = 0 for k, v in pairs(lines) do local fontcolor = Color(v.r, v.g, v.b, v.a) draw.DrawText(v.text, "CV"..v.size, 0, -(totheight/2)+curheight, fontcolor, TEXT_ALIGN_CENTER) curheight = curheight + v.theight end render.PopFilterMin() cam.End3D2D()[/lua]
[QUOTE=CherryJim;38414663] I can't see a difference? [lua]cam.Start3D2D( pos, camangle, .25 ) render.PushFilterMin(TEXFILTER.ANISOTROPIC) local curheight = 0 for k, v in pairs(lines) do local fontcolor = Color(v.r, v.g, v.b, v.a) draw.DrawText(v.text, "CV"..v.size, 0, -(totheight/2)+curheight, fontcolor, TEXT_ALIGN_CENTER) curheight = curheight + v.theight end render.PopFilterMin() cam.End3D2D()[/lua][/QUOTE] I can With no filter: [img]http://puu.sh/1pde6[/img] With min: [img]http://puu.sh/1pdeK[/img] It's never going to be perfect, but it does offer some improvement.
Sorry, you need to Log In to post a reply to this thread.