• What do you need help with? V3
    6,419 replies, posted
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?
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?
[QUOTE=Stillnex;36857167]Do you get any lua error?[/QUOTE] Nope.
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=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.
Genius, thanks for the help!
[QUOTE=Agent766;36777245] is there a way to find which player uses a certain map button?[/QUOTE] Any ideas?
[QUOTE=Agent766;36860491]Any ideas?[/QUOTE] [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html]Gamemode.PlayerUse[/url]
[QUOTE=Drakehawke;36860942][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5f71.html]Gamemode.PlayerUse[/url][/QUOTE] I love you.
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=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.
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.
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.
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=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.
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.
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]
How can i make so only a specific player can open a door? Like in RP gamemodes.
[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).
[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!
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
Two things I want to do for a SWEP. 1. I'd like a line of code that draws crosshairs if I'm using ironsights--or rather, holding down right-mouse-button. This is only for models that cannot use ironsights normally. 2. I want a line of code that disables the ability to shoot while sprinting. I'm a total noob at LUA and I'm basically self-teaching myself how to build SWEPs. If anyone cares to lend me some advice, please contact me through PMs--because lord knows I'll never find my post again in this thread.
Is there an offline copy of the backup wiki?
I found an anti-prop kill/fly/surf script that would be really useful, only it has a few problems. Can somebody please fix these? A. You can physgun other people's props to make them phase and walk through them even with an add on like FPP installed. This is detrimental to basically any RP game mode. B. You can freeze props inside of people and they don't get pushed out of them. This should probably just be fixed by causing the prop to unfreeze if it is frozen inside of a person because it already pushes props out of people when somebody puts one inside of a person. C. You can still spawn props above people or move them on top of people, then drop them to kill them. I would really appreciate if somebody could fix this script up for me; if you want to take a look at it, [URL="http://pastebin.com/hU9U2Ldj"]here it is[/URL].
[QUOTE=Lexic;36942342]Is there an offline copy of the backup wiki?[/QUOTE] Found a [URL="http://maurits.tv/data/garrysmod/GMod_Wiki.zip"]zip file[/URL] on Maurits' Webspace that says "GMod_Wiki". Maybe it's the old wiki.
[QUOTE=pennerlord;36942512]Found a [URL="http://maurits.tv/data/garrysmod/GMod_Wiki.zip"]zip file[/URL] on Maurits' Webspace that says "GMod_Wiki". Maybe it's the old wiki.[/QUOTE] It's certainly big enough. I deeply hope I'm not wasting 400MB of bandwidth for nothing. [editline]26th July 2012[/editline] Looks like that is the old wiki, thanks!
Sorry, you need to Log In to post a reply to this thread.