• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
I am using the ParticleEmitter(). How would I go about making it so you couldn't see the particles through walls?
[QUOTE=Swiftone;45667908]I am using the ParticleEmitter(). How would I go about making it so you couldn't see the particles through walls?[/QUOTE] [URL="http://wiki.garrysmod.com/page/Global/ParticleEmitter"]wiki page for ParticleEmitter()[/URL] Doesn't setting the position work? If not try using [URL="http://wiki.garrysmod.com/page/CLuaEmitter/SetNearClip"]this[/URL].
[QUOTE=Swiftone;45667908]I am using the ParticleEmitter(). How would I go about making it so you couldn't see the particles through walls?[/QUOTE] Your particles material it's using the property "$ignorez"?
[QUOTE=TrinityX;45668824]snip[/QUOTE] I am setting the position, and I don't think SetNearClip would fix the issue. [QUOTE=gonzalolog;45669216]Your particles material it's using the property "$ignorez"?[/QUOTE] I am not sure tbh. This is the effect that is giving me problems: "effects/strider_bulge_dudv_dx60" Here is how I am doing things, I'm sure it's horribly wrong: [code] if ( CLIENT ) then --I had another particle in here that you were not able to see through walls, I removed it to make things a little more simple function ENT:Initialize() local centr = self:GetPos() local em = ParticleEmitter(centr) self.part2 = em:Add("effects/strider_bulge_dudv_dx60",centr) self.part2:SetDieTime(100000) self.part2:SetLifeTime(0) self.part2:SetStartSize(25) self.part2:SetEndSize(25) em:Finish() end function ENT:OnRemove() self.part2:SetDieTime(1) end function ENT:Draw() self:DrawShadow( false ) local centr = self:GetPos() self.part2:SetPos(centr) end end [/code]
It is a bit old problem, but i want that problem will be solved. Few years ago i made a map called gm_sabspark_v4. When i click on Start New Game button in the main menu, suddenly the map is now called as gm_sark_v4. When i click on the Start Game button, the game throw me back to main menu and console writes this: [CODE] CModelLoader::Map_IsValid: No such map 'maps/gm_sark_v4.bsp' map load failed: gm_sark_v4 not found or invalid [/CODE] I understand, the map isn't exist. It looks like, the game is checking "bsp" in the name of map and then remove it, but why is this happening at full name of map? Why not only at the end of name? Here is the link: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=173583371[/url] Maybe i found it, garrysmod/lua/menu/getmaps.lua file line 231. string.gsub do this. Could some developer fix that please?
What is the hook for voice chat? I want to make it return false to disable voice chat for the player on a current team.
i hope this isnt the wrong section Can anyone recommend a good lightweight admin addon? I've tried Chessnut's moderator but it breaks one of the commands in my gamemode
[QUOTE=bran92don;45671043]What is the hook for voice chat? I want to make it return false to disable voice chat for the player on a current team.[/QUOTE] [url="http://wiki.garrysmod.com/page/GM/PlayerCanHearPlayersVoice"]New Wiki PlayerCanHearPlayersVoice[/url] <-- server [url="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1bc4.html"]Old Wiki PlayerCanHearPlayersVoice[/url] [url]http://wiki.garrysmod.com/page/GM/PlayerEndVoice[/url] <--client [url]http://wiki.garrysmod.com/page/GM/PlayerStartVoice[/url] <--client [QUOTE=thefreemann;45671663]Can anyone recommend a good lightweight admin addon? I've tried Chessnut's moderator but it breaks one of the commands in my gamemode[/QUOTE] Please try searching the forums before asking. There have been a lot of these types of questions [url]http://facepunch.com/showthread.php?t=1416157[/url]
What would be the best way of randomly placing an entity in the world so that it does end up in the void? Like if I want to randomly spawn a gun somewhere that people can use. Thanks
[QUOTE=WalkingZombie;45663966]How do I set a console variable in Lua? For instance, I want to make phys_timescale 0.1, or sv_cheats 1, or player_old_armor 1, even host_timescale 0.5. I know there's a menu in SandBox where you can change a few, but I can't find the code![/QUOTE] [lua] local val = 0 concommand.Add( "sv_test", function( ply, _, args ) val = tonumber( args[1] ) or val end ) [/lua] As a question of my own, I've been trying to make tables use metatables ( if that makes sense ) and I can't seem to get one thing to work: [lua] local mt = {} local methods = {} mt.__index = methods function table.new( tbl ) return setmetatable( tbl or {}, mt ) end // this is what isn't working, I'm trying to automatically add every function from the table library onto the metatable for k, v in pairs( table ) do if k != 'new' and type( v ) == 'function' then mt[k] = v end end concommand.Add( "resetMeta", function() for k, v in pairs( table ) do if k != 'new' and type( v ) == 'function' then print( k .. "\n" ) mt[k] = v end end end ) [/lua] All of the functions are on the metatable, but the table object returns nil for them. Any idea why?
Is there a way to check what OS a client is using? I'd like to give Mac users special items in my server. I tried searching but all I really found were people having in-game issues on OSX. Are there files that exist on only Macs or something? It's not a big deal if people fake that they are using a Mac.
[QUOTE=jackool;45673065]Is there a way to check what OS a client is using? I'd like to give Mac users special items in my server. I tried searching but all I really found were people having in-game issues on OSX. Are there files that exist on only Macs or something? It's not a big deal if people fake that they are using a Mac.[/QUOTE] [url]http://wiki.garrysmod.com/page/system/IsOSX[/url]
[QUOTE=HumbleTH;45672320][lua] local val = 0 concommand.Add( "sv_test", function( ply, _, args ) val = tonumber( args[1] ) or val end ) [/lua][/QUOTE] I don't want to make my own console variable, I want to change one that already exists in the hardcode, such like the examples I provided.
[QUOTE=Exho;45672016]What would be the best way of randomly placing an entity in the world so that it does end up in the void? Like if I want to randomly spawn a gun somewhere that people can use. Thanks[/QUOTE] Any of the below will work. [code] local Mins, Maxs = Entity(0):GetPhysicsObject():GetAABB( ) local Xmax = Maxs[1] local Xmin = Mins[1] local Ymax = Maxs[2] local Ymin = Mins[2] local Zmax = Maxs[3] local Zmin = Mins[3] local Randpos = Vector(math.Rand(Xmin,Xmax),math.Rand(Ymin,Ymax),math.Rand(Zmin,Zmax)) [/code] [URL="http://wiki.garrysmod.com/page/util/IsInWorld"]Vector Position is in world[/URL] [URL="http://wiki.garrysmod.com/page/Entity/IsInWorld"]Entity is in world[/URL]
[QUOTE=Joeyl10;45673095][url]http://wiki.garrysmod.com/page/system/IsOSX[/url][/QUOTE] Doh! Should have known to check the wiki. Thanks.
How can you draw a circular hud?
[url]http://wiki.garrysmod.com/page/surface/DrawPoly[/url] or materials.
You could use this [URL="http://fcpn.ch/c6vle"]Arc API[/URL] which allows circles and arcs of different sizes and thicknesses.
[QUOTE=WalkingZombie;45673156]I don't want to make my own console variable, I want to change one that already exists in the hardcode, such like the examples I provided.[/QUOTE] Oh, sorry, didn't misunderstood the question. You could probably just use game.ConsoleCommand on server
Is there a way to get what the console says through the concommand "say". Note that I need this serverside, so I cannot use OnPlayerChat. Also, PlayerSay does **NOT** get called when the console says something, is this a bug? If not, is there any alternatives to getting whatever the console says?
From what I remember PlayerSay does get called with the console, but with the passed player as NULL.
[QUOTE=Braden1996;45637871]When I overwrite the Paint function of a panel and I set the DrawColor to a particular color; that color isn't the color which is being used to draw the panel. (As I can tell by print-screening and using Photoshop's color eye-dropper). However, the color remains very similar. Does anybody know why this is?[/QUOTE] If you're talking about built in panels, then it's because panels aren't painted using surface methods, it's drawn with a texture using GWEN, which can't really change color. What you could do is overwrite the paint function, draw the old paint function, then draw a rectangle ontop of the panel with the color you want, but give it some transparency. This will render an 'overlay' that will tint the gwen skin. This doesn't always make it look good though. [editline]13th August 2014[/editline] [QUOTE=Jvs;45678488]From what I remember PlayerSay does get called with the console, but with the passed player as NULL.[/QUOTE] That's exactly what I meant, it does not. Only OnPlayerChat does. Someone please tell me i'm not crazy :/
I don't know how else to do this but this is what I'm doing [code]if self.Owner:KeyDown( IN_ATTACK2 ) then if self.Owner:KeyDown( IN_FORWARD ) and self.Owner:KeyDown( IN_MOVELEFT ) then self.WeaponSlot = 8 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_FORWARD ) and self.Owner:KeyDown( IN_MOVERIGHT ) then self.WeaponSlot = 2 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_BACK ) and self.Owner:KeyDown( IN_MOVELEFT ) then self.WeaponSlot = 6 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_BACK ) and self.Owner:KeyDown( IN_MOVERIGHT ) then self.WeaponSlot = 4 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_FORWARD ) then self.WeaponSlot = 1 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_MOVELEFT ) then self.WeaponSlot = 7 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_MOVERIGHT ) then self.WeaponSlot = 3 UpdateSpell(self) SetUpSpells(self) elseif self.Owner:KeyDown( IN_BACK ) then self.WeaponSlot = 5 UpdateSpell(self) SetUpSpells(self) end end [/code] Basically you switch your "weapon slot" if you press mouse 2 and certain keys, but Clientside is faster than Serverside when detecting keypresses and it basically gives the wrong information because they usually don't match up if you press keys fast enough. This is located in SWEP:Think().
[QUOTE=ROFLBURGER;45679381]I don't know how else to do this but this is what I'm doing[/QUOTE] [lua]local slots = { [IN_FORWARD] = 1, [IN_FORWARD + IN_MOVERIGHT] = 2, [IN_MOVERIGHT] = 3, [IN_BACK + IN_MOVERIGHT] = 4, [IN_BACK] = 5, [IN_BACK + IN_MOVELEFT] = 6, [IN_MOVELEFT] = 7, [IN_FORWARD + IN_MOVELEFT] = 8 } if(self.Owner:KeyDown(IN_ATTACK2)) then local inkeys = self.Owner:KeyDown(IN_FORWARD) and IN_FORWARD or 0 + self.Owner:KeyDown(IN_BACK) and IN_BACK or 0 + self.Owner:KeyDown(IN_MOVELEFT) and IN_MOVELEFT or 0 + self.Owner:KeyDown(IN_MOVERIGHT) and IN_MOVERIGHT or 0 self.WeaponSlot = slots[inkeys] UpdateSpell(self) SetUpSpells(self) end[/lua] as for the lag, you might have to have a little deploy period when you switch where you can't use the spell while the server catches up
[QUOTE=PortalGod;45679753][lua]local slots = { [IN_FORWARD] = 1, [IN_FORWARD + IN_MOVERIGHT] = 2, [IN_MOVERIGHT] = 3, [IN_BACK + IN_MOVERIGHT] = 4, [IN_BACK] = 5, [IN_BACK + IN_MOVELEFT] = 6, [IN_MOVELEFT] = 7, [IN_FORWARD + IN_MOVELEFT] = 8 } if(self.Owner:KeyDown(IN_ATTACK2)) then local inkeys = self.Owner:KeyDown(IN_FORWARD) and IN_FORWARD or 0 + self.Owner:KeyDown(IN_BACK) and IN_BACK or 0 + self.Owner:KeyDown(IN_MOVELEFT) and IN_MOVELEFT or 0 + self.Owner:KeyDown(IN_MOVERIGHT) and IN_MOVERIGHT or 0 self.WeaponSlot = slots[inkeys] UpdateSpell(self) SetUpSpells(self) end[/lua] as for the lag, you might have to have a little deploy period when you switch where you can't use the spell while the server catches up[/QUOTE] I couldn't get the code you pasted working, but I took your idea and made it work using NW variables. I'm pretty happy right now.
[QUOTE=solid_jake;45660973]I'm trying to make an npc that the player can talk to. So far everything works except the model is stuck in T-Pose as opposed to having the idle animation. Can anyone tell me where I went wrong? [lua] self:SetModel( self.Model ) local sequence = self:LookupSequence("idle") self:SetSequence(sequence) self.Entity:PhysicsInit( SOLID_BBOX ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_BBOX ) self:DrawShadow(true) self.Entity:SetCollisionGroup( COLLISION_GROUP_NONE ) self.Entity:SetUseType(ONOFF_USE) self.Entity:DropToFloor() self.DieTime = CurTime() + 30[/lua][/QUOTE] Try using something like this: [lua] ENT.Base = "base_ai" function ENT:Initialize() self:SetTrigger(true) self:SetHullType( HULL_HUMAN ) self:SetHullSizeNormal( ) self:SetNPCState( NPC_STATE_IDLE ) self:SetSolid( SOLID_BBOX ) self:CapabilitiesAdd( bit.bor(CAP_ANIMATEDFACE , CAP_TURN_HEAD) ) self:SetUseType( SIMPLE_USE ) self:DropToFloor() end [/lua]
Edited: Eh forget it I managed.
[QUOTE=gonzalolog;45669216]Your particles material it's using the property "$ignorez"?[/QUOTE] Thank you, I just found that in the material file.
[QUOTE=HumbleTH;45676355]Oh, sorry, didn't misunderstood the question. You could probably just use game.ConsoleCommand on server[/QUOTE] Thank you! I noticed the example: [code]game.ConsoleCommand( "sv_gravity 400\n" )[/code]
[QUOTE=HumbleTH;45672320] As a question of my own, I've been trying to make tables use metatables ( if that makes sense ) and I can't seem to get one thing to work: [lua] local mt = {} local methods = {} mt.__index = methods function table.new( tbl ) return setmetatable( tbl or {}, mt ) end // this is what isn't working, I'm trying to automatically add every function from the table library onto the metatable for k, v in pairs( table ) do if k != 'new' and type( v ) == 'function' then mt[k] = v end end concommand.Add( "resetMeta", function() for k, v in pairs( table ) do if k != 'new' and type( v ) == 'function' then print( k .. "\n" ) mt[k] = v end end end ) [/lua] All of the functions are on the metatable, but the table object returns nil for them. Any idea why?[/QUOTE] Anyone?
Sorry, you need to Log In to post a reply to this thread.