• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=Phoenixf129;47395448]Try SetDrawOnTop(true) on the panels you don't want it overlapping.[/QUOTE] i love u
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?
Is there anyway to refract elements on a HUD hook? I'm trying to use a refract texture in a surface.DrawTexturedRect( ) above a stenciled RT, which simply makes the RT invisible and refracts everything behind it. [I]Without refract:[/I] [t]http://cloud-4.steamusercontent.com/ugc/530637206227626496/A4A911C823457CA511F99B087BE56B1DBCB2319C/[/t] [i]With refract:[/i] [t]http://cloud-4.steamusercontent.com/ugc/530637206227626299/DF671479282CF581259D020190BA06AB6693A975/[/t]
Is there a noticeable performance impact to successive SQL queries? The main question is if I will have to stagger the larger sets of queries to prevent excessive load or lock-up. The module in question is tmysql4.
Hey guys, is there a way to freeze entities like grenades and weapons when they spawn? I've got some deathrun maps that got secret nades but when they spawn they move and fall to where it's impossible to get them. Thanks.
ent:GetPhysicsObject():EnableMotion(false) or ent:GetPhysicsObject():Sleep().
[QUOTE=G4MB!T;47398301]ent:GetPhysicsObject():EnableMotion(false) or ent:GetPhysicsObject():Sleep().[/QUOTE] I take it the first disables physics altogether for the ent while the second puts it in a dormant mode until it's touched/interacted with? Could I get a template for ents that start with weapon_, please? I'm really lua retarded, I absolutely have no idea how to make it look for every gun that spawn etc. :/
[QUOTE=Exho;47395196]How can I stop the HL2 looping wav files? I use sound.Play[/QUOTE] Use CSoundPatch instead.
[QUOTE=rikyy;47398316]I take it the first disables physics altogether for the ent while the second puts it in a dormant mode until it's touched/interacted with? Could I get a template for ents that start with weapon_, please? I'm really lua retarded, I absolutely have no idea how to make it look for every gun that spawn etc. :/[/QUOTE] In InitPostEntity just do something like: [lua] for k,v in pairs(ents.GetAll()) do if (!v:IsWeapon()) then continue; end v:GetPhysicsObject():EnableMotion(false); end [/lua]
I asked this a while ago but I'm too bad at lua to figure it out - is there some sort of guide/tutorial/good example of code where I can see how to network a clientside menu in gamemode that would spawn an entity also in my gamemode, and also let me run some code at the same time (deducting money or something), I've looked at stuff like dark rp and honestly can't figure out how to do the same
[QUOTE=Smt;47398827]I asked this a while ago but I'm too bad at lua to figure it out - is there some sort of guide/tutorial/good example of code where I can see how to network a clientside menu in gamemode that would spawn an entity also in my gamemode, and also let me run some code at the same time (deducting money or something), I've looked at stuff like dark rp and honestly can't figure out how to do the same[/QUOTE] Clientside, you'll want to look into [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/vgui]vgui[/url] for the clientside menu, that calls [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/concommand]concommands[/url]. Serverside, you'll need to register a concommand to spawn the entity with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ents/Create]ents.Create[/url], as well as run whatever auxiliary code you want to run. If you give me a few secs I'll whip up an example.
Client side; [lua]net.Receive("mymenu_open", function ( length, server ) -- code to the menu here (vgui, derma, etc) end )[/lua] And server side; [lua]util.AddNetworkString "mymenu_open" -- Now to open the menu you made client side on a player / everyone, do this; net.Start "mymenu_open" --net.Broadcast ( ) -- This is used to broadcasting the net message to ever player on the server --net.Send ( player.GetByID ( 1 ) ) -- This sends the net message to Player 1, which makes the menu you created above appear ( the code gets ran ) [/lua]
I have the menu already, it's basically just a panel with a grid in with all my items in, just gotta figure out the part where instead of making it print some text, clicking the icons will make it spawn, but hopefully I can work it out from what you guys posted edit: I'm too stupid, can I pay someone to upload their lua knowledge so I can implant it into my head
-snip automerge isn't as lenient as i thought i apologize-
CL [lua] local button = vgui.Create("DButton") button.DoClick = function() net.Start("ent") net.WriteInt(1,5) net.SendToServer() end [/lua] SV [lua] local enttbl = {[1]= "ttt_healthstation", [2] = "ttt_knife_proj"} local function EntCreation(len, ply) local entid = net.ReadInt(5) local realent = ents.Create(enttbl[entid]) end net.Recieve("ent", EntCreation) [/lua]
snip
[QUOTE=G4MB!T;47398368]In InitPostEntity just do something like: [lua] for k,v in pairs(ents.GetAll()) do if (!v:IsWeapon()) then continue; end v:GetPhysicsObject():EnableMotion(false); end [/lua][/QUOTE] I really appreciate your help, sincerely, but I can't find any InitPostEntity anywhere? Could you be a little more precise, please? EDIT: [lua] if SERVER then hook.Add("InitPostEntity","FreezeProps",function() for k,v in pairs(ents.GetAll()) do if (!v:IsWeapon()) then continue; end v:GetPhysicsObject():EnableMotion(false); end end end [/lua] Like that? Where do I put it?
[QUOTE=MuteTM;47398216]Is there a noticeable performance impact to successive SQL queries? The main question is if I will have to stagger the larger sets of queries to prevent excessive load or lock-up. The module in question is tmysql4.[/QUOTE] It depends on what kind of query you are running, and how efficient your database is setup. Assuming you have a perfect setup, and are doing a pretty lightweight query, it shouldn't be bad. SELECT statements might cause you more trouble than INSERTs. For example, I am logging every shot fired (who, where, what direction, who did it hit, what did it hit, damage). When I tested it with 30 bots all mimicking me and firing AK47s at each other, I think my server dropped 2 frames (probably just to the shooting, not the queries).
[QUOTE=MuteTM;47398216]Is there a noticeable performance impact to successive SQL queries? The main question is if I will have to stagger the larger sets of queries to prevent excessive load or lock-up. The module in question is tmysql4.[/QUOTE] tmysql is pretty forgiving and shouldn't cause issues.
Just wondering, are you guys using the net or umsg libraries to open menus etc?
[QUOTE=RedNinja;47401127]Just wondering, are you guys using the net or umsg libraries to open menus etc?[/QUOTE] I'd rather open menus clientside so that network latency is not involved.
[QUOTE=RedNinja;47401127]Just wondering, are you guys using the net or umsg libraries to open menus etc?[/QUOTE] hooks. damnit, yeah, what willox said.
Could someone tell me the functions I'd need to use to create a camera that the player can view? Preferably a way that will draw the visleaf the camera is viewing etc.
What causes CurTime to get off sync? Does it just become inaccurately tracked clientside from what the player joins?
[img]http://puu.sh/gS83L/22a9d9ae13.png[/img] Even when removing the outline I still get this issue with the text overlapping. [code]surface.CreateFont( "SRH_DERMA", { font = "arial", size = 18, weight = 350 } )[/code]
I have that too, I fix it by either adding or subtracting 1 by the original font size.
Hey guys, I'm trying to fix an old SWEP I made before Gmod13, basically it just creates an explosion where I'm aiming, the problem is the explosion does no damage, it does do the explosion effect. [lua]SWEP.Primary.NumShots = 1 SWEP.Primary.Force = 10000 SWEP.Primary.Spread = 0.1 SWEP.Primary.Sound = "weapons/strider_buster/Strider_Buster_detonate.wav" SWEP.Primary.DefaultClip = 100 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "RPG_Round" SWEP.Primary.Recoil = 1 SWEP.Primary.Delay = 0.45 SWEP.Primary.TakeAmmo = 1 SWEP.Primary.ClipSize = 100 SWEP.Primary.Damage = 1000 function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local rnda = -self.Primary.Recoil local rndb = self.Primary.Recoil * math.random(-1, 1) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) local eyetrace = self.Owner:GetEyeTrace() self:EmitSound ( self.Primary.Sound ) //Adds firing sound self:ShootEffects() self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) if IsValid(self.Owner) && IsValid(self.Weapon) then if (SERVER) then local explode = ents.Create("env_explosion") explode:SetPos( eyetrace.HitPos ) explode:SetOwner( self.Owner ) explode:Spawn() //Spawns the entity explode:SetKeyValue("iMagnitude", "1000") explode:Fire("Explode", 0, 00 ) explode:EmitSound("BaseExplosionEffect.Sound", 400, 400 ) end end end [/lua]
[img]http://i.imgur.com/7H0C3px.png[/img] [img]http://i.imgur.com/C7LFoSe.png[/img] [img]http://i.imgur.com/UByotUT.png[/img] Why is this ent invisible?
Have you modified the Draw method? Also you should be using self rather than self.Entity
[QUOTE=Willox;47409997]Have you modified the Draw method?[/QUOTE] No
Sorry, you need to Log In to post a reply to this thread.