• What do you need help with? V3
    6,419 replies, posted
  • Avatar of ollie
  • [QUOTE=goldenlukis;36836929]You're using the path to the NPC¨model, use tha path to the player model. "models/player/Group03/male_02.mdl"[/QUOTE] Thanks a lot!
  • Avatar of PaellaPablo
  • Rather simple, but I don't know what hook this would go on. Essentially, for the deathrun gamemode I am working on, players will have the ability to use !redie, meaning if they die and have the upgrade, they can respawn as a 'Ghost' and run around and such. I want to know how to disable the ghosts from activating triggers/pressure plates and stuff like that. My current use is via a network boolean of "DEAD", and this disables them from picking up weapons/ hurting players/ pressing buttons. tl;dr How do I stop a player from being able to activate things like trigger_once, breaking func_breakables, and all that type of thing.
  • Avatar of ash47
  • Is there a way to do a trace that will tell me if it hits NPC Clip? ("tools/toolsnpclip" in hammer) Edit: Solved it myself: mask = MASK_NPCSOLID_BRUSHONLY
  • I'm trying to make a round timer in cl_init, counting down from 300 seconds: function DrawTimer() local roundLength = 300 local time = round(NextPrintTime,0) local roundtimeleft = roundLength - time local roundsInSession = 0 if (CurTime() >= NextPrintTime) then function self:HUDPaint() if roundtimeleft > 0 then draw.RoundedBox(6, ScrW()/2 - 120, 0, 243,50, Color(50,50,50,200)) draw.DrawText("Time Left in Round: "..roundtimeleft.." seconds", "ScoreboardText", ScrW() / 2, 15, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER) else roundsInSession = roundsInSession + 1 roundtimeleft= roundtimeleft +(300*roundsInSession) draw.RoundedBox(6, ScrW()/2 - 120, 0, 243,50, Color(50,50,50,200)) draw.DrawText("Time Left in Round: "..roundtimeleft.." seconds", "ScoreboardText", ScrW() / 2, 15, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER) end end NextPrintTime = CurTime() - 2 end end hook.Add("Think", "DrawTimer", DrawTimer) end However this only runs for two iterations before going onward to negative infinity... how could I get it to loop endlessly?
  • Trying to create a console command that the clients can use. When created serverside, the clients cannot use the command (Unknown Command: useme) When created shared, the clients can use the command, but the server doesn't know that they do. Serverside: [lua] if SERVER then concommand.Add("useme",function(pl,cmd,args) print("command used") end) end [/lua] Server can use it, but clients can't. Shared is the same as above without the if SERVER then statement.
  • Awkward, I have all my concommands server side and I can use them at the client, does it really gives you Unknown Command: useme or you assume that?
  • Avatar of Commander11
  • Does anyone know how to combat this wretched error? I get it on Gmod startup. [IMG]http://i209.photobucket.com/albums/bb65/Commander_08/NewBitmapImage-3.jpg[/IMG] Oops, nvm. [URL]http://facepunch.com/showthread.php?t=1181764[/URL]
  • [QUOTE=Stillnex;36854465]Awkward, I have all my concommands server side and I can use them at the client, does it really gives you Unknown Command: useme or you assume that?[/QUOTE] It does say that, even in chat.
  • [QUOTE=skullorz;36857092]It does say that, even in chat.[/QUOTE] Do you get any lua error?
  • Does anyone know how to get the size of a ClientsideModel? Entity.OBBMaxs, Entity.OBBMins and Entity.WorldSpaceAABB all return a zero vector, which I'll guess is because clientside models don't have physics hulls but I don't know for sure Sample code; [lua]local mdl = ClientsideModel( "models/props_combine/breenbust.mdl", RENDER_GROUP_OPAQUE_ENTITY ) local min, max = mdl:WorldSpaceAABB() print(min, max) -- 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 print(mdl:OBBMaxs()) -- 0.0000 0.0000 0.0000 print(mdl:OBBMins()) -- 0.0000 0.0000 0.0000[/lua]
  • Avatar of Drakehawke
  • [QUOTE=Splambob;36857773]Does anyone know how to get the size of a ClientsideModel? Entity.OBBMaxs, Entity.OBBMins and Entity.WorldSpaceAABB all return a zero vector, which I'll guess is because clientside models don't have physics hulls but I don't know for sure Sample code; [lua]local mdl = ClientsideModel( "models/props_combine/breenbust.mdl", RENDER_GROUP_OPAQUE_ENTITY ) local min, max = mdl:WorldSpaceAABB() print(min, max) -- 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 print(mdl:OBBMaxs()) -- 0.0000 0.0000 0.0000 print(mdl:OBBMins()) -- 0.0000 0.0000 0.0000[/lua][/QUOTE] You could try [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9858.html]ent:GetRenderBounds()[/url], I haven't tested it but it might work.
  • Avatar of Agent766
  • [QUOTE=Agent766;36777245] is there a way to find which player uses a certain map button?[/QUOTE] Any ideas?
  • Avatar of Drakehawke
  • [QUOTE=Agent766;36860491]Any ideas?[/QUOTE] [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html]Gamemode.PlayerUse[/url]
  • Avatar of Agent766
  • [QUOTE=Drakehawke;36860942][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html]Gamemode.PlayerUse[/url][/QUOTE] I love you.
  • Avatar of kp3
  • How do I create bots? Simply typing "Bot" in the console does nothing for me. Does it need to be a dedicated server? Tried searching but forums doesn't like three letter words.
  • Avatar of Drakehawke
  • [QUOTE=kp3;36869360]How do I create bots? Simply typing "Bot" in the console does nothing for me. Does it need to be a dedicated server? Tried searching but forums doesn't like three letter words.[/QUOTE] Listen/dedicated server should work fine but it wont in singleplayer.
  • Avatar of Rayne Rimsek
  • So.. Currently I've been working on modifying a Riot Shield, and I've been having a ton of problems with using SetParentAttachmentMaintainOffest.. It works fine, as long as I'm facing one direction.. I was trying to research it, and I believe it was something to do with the world position/angle's relativity to the local position/angle. Here is my code: [code]function SWEP:Deploy() if SERVER then if ValidEntity(self.ent) then return end //Makes it not able to spawn multiple entities. self.Owner:SetRunSpeed(125) self.Owner:SetWalkSpeed(125) self:SetColor(255,255,255,0) self.ent = ents.Create("prop_physics") self.ent:SetModel("models/arleitiss/riotshield/shield.mdl") self.ent:SetParent(self.Owner) par = self.ent:GetParent() hand = par:LookupBone("ValveBiped.Anim_Attachment_RH") local pos, ang = par:GetBonePosition( hand ) [B] self.ent:SetPos(pos + Vector (-12,-10,-22)) self.ent:SetAngles(ang + Angle(0,-180,0)) self.ent:Fire("SetParentAttachmentMaintainOffest", "anim_attachment_RH", 0.01)[/B] self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) // Lets it not collide to anything but world. Taken from Nocollide self.ent:Spawn() self.ent:Activate() end return true end[/code] Here are the screenshot's of what happens: This is when it is selected while facing the correction direction, and how I want it to look. [url]http://cloud.steampowered.com/ugc/938123552424315203/06DC0A70E53A547F2337E13DD4FF424DF2C513E1/[/url] This is what happens otherwise.. [url]http://cloud-2.steampowered.com/ugc/938123552424464091/7FFC1C25CBF60973ECEBD42C5E7C0C7BDC3CCBB5/[/url] I would prefer using SetParentAttachment but then I cant change the position/angle and it isn't attached in the correct position. Anyone know what I can do to fix it? Im quite new to lua scripting by the way.. Thank you.
  • Avatar of CapsAdmin
  • Does anyone know why I'm getting the player origin for some bones? It's just that on my public dedicated server all the bones work fine, but on my local dedicated server with a lot less addons, most of the bones return to ply:GetPos() my local dedicated server [img]https://dl.dropbox.com/u/244444/ShareX/2012-07/2012-07-22_14-35-19.jpg[/img] my public dedicated server [img]https://dl.dropbox.com/u/244444/ShareX/2012-07/2012-07-22_14-41-30.jpg[/img] So the bone "right finger 2" exists and all, it just returns to player origin in some maps (??) or in some servers (??) I'm just really confused about this. The same goes for other models as well. On my public dedicated server I can get the position and angles of jeep tires but on my local dedicated server they return to jeep origin. (Note that it's actually ValveBiped.RightFinger02 internally in the code, I'm just generating friendly names from the literal bone names) [QUOTE=Rayne Rimsek;36875634]So.. Currently I've been working on modifying a Riot Shield, and I've been having a ton of problems with using SetParentAttachmentMaintainOffest.. It works fine, as long as I'm facing one direction.. I was trying to research it, and I believe it was something to do with the world position/angle's relativity to the local position/angle. Here is my code: [code]function SWEP:Deploy() if SERVER then if ValidEntity(self.ent) then return end //Makes it not able to spawn multiple entities. self.Owner:SetRunSpeed(125) self.Owner:SetWalkSpeed(125) self:SetColor(255,255,255,0) self.ent = ents.Create("prop_physics") self.ent:SetModel("models/arleitiss/riotshield/shield.mdl") self.ent:SetParent(self.Owner) par = self.ent:GetParent() hand = par:LookupBone("ValveBiped.Anim_Attachment_RH") local pos, ang = par:GetBonePosition( hand ) [B] self.ent:SetPos(pos + Vector (-12,-10,-22)) self.ent:SetAngles(ang + Angle(0,-180,0)) self.ent:Fire("SetParentAttachmentMaintainOffest", "anim_attachment_RH", 0.01)[/B] self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) // Lets it not collide to anything but world. Taken from Nocollide self.ent:Spawn() self.ent:Activate() end return true end[/code] Here are the screenshot's of what happens: This is when it is selected while facing the correction direction, and how I want it to look. [url]http://cloud.steampowered.com/ugc/938123552424315203/06DC0A70E53A547F2337E13DD4FF424DF2C513E1/[/url] This is what happens otherwise.. [url]http://cloud-2.steampowered.com/ugc/938123552424464091/7FFC1C25CBF60973ECEBD42C5E7C0C7BDC3CCBB5/[/url] I would prefer using SetParentAttachment but then I cant change the position/angle and it isn't attached in the correct position. Anyone know what I can do to fix it? Im quite new to lua scripting by the way.. Thank you.[/QUOTE] You can't add your own offsets when using attachment without that happening. You're supposed to do that in the model itself since it assumes the model's attachment point is already corrected in the model itself. The only way I can think of is to do it clientside. If you want the shield to actually be physical you can try and use [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexed9c.html]PhysObj.ComputeShadowControl [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] or just simply phys:SetPos(pos) and phys:SetAngle(ang) in a think hook on the server while doing the same exact on client to make it look smooth. SetPos and SetAngle on the physics object might screw with collisions though.
  • Avatar of Rayne Rimsek
  • I ended up finding a new method that works well.. Now my problem is that I wasn't quite paying attention, and didn't notice that my shield is made of glass. Madcows sweps shoot clean through it. Anyone know how to change the physical properties of a physics prop within a script?
  • Avatar of Drakehawke
  • [QUOTE=Rayne Rimsek;36887037]I ended up finding a new method that works well.. Now my problem is that I wasn't quite paying attention, and didn't notice that my shield is made of glass. Madcows sweps shoot clean through it. Anyone know how to change the physical properties of a physics prop within a script?[/QUOTE] Take a look at the source for the physical properties tool included in GMod.
  • Avatar of Jawalt
  • Would anyone who's decent with 3d math be willing to add me on Steam and help me out? The code is from a project and would take a pretty long time to turn into something that was understandable just in a forum post.
  • Avatar of wanksta11
  • Could someone fix this? [url]http://www.garrysmod.org/downloads/?a=view&id=101997[/url] I mean you just put the drugs in him and nothing happens.
  • Hi I need help with something :o [img]http://puu.sh/KW02[/img] The texture glitches out when ever you look around and you can see all entities passed it. Thanks in advance. [lua]local w = 406 local h = 220 function ENT:DrawScreen() surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawRect( 0, 0, w, h ) local mat = Material( "models/props_wasteland/dirtwall001a" ) render.SetMaterial( mat ) render.DrawQuad(Vector(0, 0, 0), Vector(w, 0, 0), Vector(w, h, 0), Vector(0, h, 0)) end /*--------------------------------------------------------- Name: DrawPre ---------------------------------------------------------*/ function ENT:Draw() self:DrawModel() local ang = self:GetAngles() local pos = self:GetPos() - Vector( 0, 0, 15 ) + ang:Up() --ang:RotateAroundAxis( ang:Forward(), 90 ) --ang:RotateAroundAxis( ang:Right(), 90 ) -- This makes the screen show all the time self:SetRenderBoundsWS(Vector(-1100, -1100, -1100) + self:GetPos(), Vector(1100, 1100, 1100) + self:GetPos()) cam.Start3D2D( pos, Angle( 0, ang.y, ang.r ), 0.55 ) self:DrawScreen() cam.End3D2D() end [/lua]
  • Avatar of ollie
  • How can i make so only a specific player can open a door? Like in RP gamemodes.
  • Avatar of pennerlord
  • [QUOTE=ollie;36896453]How can i make so only a specific player can open a door? Like in RP gamemodes.[/QUOTE] You could try to use the [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html"]PlayerUse[/URL] Hook and check if the player is in a table. Return true if he is (otherwise return false).
  • Avatar of ollie
  • [QUOTE=pennerlord;36896714]You could try to use the [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html"]PlayerUse[/URL] Hook and check if the player is in a table. Return true if he is (otherwise return false).[/QUOTE] Oh i forgot that hook, thanks a lot!
  • Avatar of wanksta11
  • Everyone in my server is getting this error while using keypads that don't even work. FCVAR_SERVER_CAN_EXECUTE prevented server running command: +gm_special FCVAR_SERVER_CAN_EXECUTE prevented server running command: -gm_special