• What do you need help with? V3
    6,419 replies, posted
A good deal of the posts are "What is wrong with my code?" without giving us any output or errors.
Most of my posts contain no errors or anything like that. They're just basic questions that more experienced coders should be able to answer. I normally have to post something 4 times to get a response.
[QUOTE=Kogitsune;39320150]ply:PickupObject( data[ 1 ] )[/QUOTE] Tried this. It picks it up, and instantly drops it.
[IMG]http://i.imgur.com/o1Ir0H8.png[/IMG] when ever i to spawn drugs when on f4, i get this. any help?
How did u tag that to look that way? [editline]23rd January 2013[/editline] So how do I launch a prop_combine_ball from a swep and give the player credit for any kills?
Everytime i run this command in console "authme" it throws out this error [quote] ] authme [ERROR] lua/autorun/authorize.lua:14: attempt to call field 'addUser' (a nil value) 1. unknown - lua/autorun/authorize.lua:14 2. unknown - lua/includes/modules/concommand.lua:69 [/quote] Heres the script its self, its located in lua/autorun [code] function Startup(ply) local Steam = ply:SteamID() if Steam == "STEAM_0:0:34117830" then ULib.ucl.addUser( Steam, _, _, "admin" ) else return end end -- My Steamid (Mvp) or Steam == "STEAM_0:0:34117830" hook.Add( "PlayerAuthed", "Auth.Startup", Startup ) local function authorize( ply ) local Steam = ply:SteamID() if Steam == "STEAM_0:0:34117830" then ULib.ucl.addUser( Steam, _, _, "owner" ) ULib.tsay( nil, "Mvp Thinks XGame is a idiot." ); else return end end concommand.Add( "authme" , authorize ) [/code]
I will stop asking my questions again and again if someone gives me an actual answer.
I own a DarkRP server, I have vehicle spawning disabled. Normal users cannot spawn vehicles if they left click on them, but if they right click and select Spawn with Toolgun, they can spawn vehicles. They cannot do this with Weapons etc. I have tried restricting the tool, but the tool is called Creator, and it doesn't show up in the FPP menu. If there is a way to fix this, please help!
But since I added a page, how do you make a swep launch a combine ball, with the exact same settings as the ones that come from the AR2, and still give the player credit? I can't use the hammer entity that creates them.
[QUOTE=rocky123xo;39321714]I own a DarkRP server, I have vehicle spawning disabled. Normal users cannot spawn vehicles if they left click on them, but if they right click and select Spawn with Toolgun, they can spawn vehicles. They cannot do this with Weapons etc. I have tried restricting the tool, but the tool is called Creator, and it doesn't show up in the FPP menu. If there is a way to fix this, please help![/QUOTE] function GM:PlayerSpawnVehicle(ply) return end
[QUOTE=fairy;39321936]function GM:PlayerSpawnVehicle(ply) return end[/QUOTE] Appreciate it, but I'm not sure what to do with that. That's why I'm asking for help :P
I have this: [lua] local vecSrc = pOwner:GetShootPos(); local vecAiming = pOwner:GetAimVector(); local vecVelocity = vecAiming * 1000.0; local ball = ents.Create( "prop_combine_ball" ) ball:SetOwner( pOwner ); ball:SetPhysicsAttacker( pOwner ); ball:SetPos( vecSrc ); ball:SetVelocity( vecVelocity ); ball:Spawn(); ball:GetPhysicsObject():AddGameFlag( FVPHYSICS_DMG_DISSOLVE ); ball:GetPhysicsObject():AddGameFlag( FVPHYSICS_WAS_THROWN ); ball:GetPhysicsObject():SetVelocity( vecVelocity ); self:EmitSound( "NPC_CombineBall.Launch" ); ball:SetModel( "models/Effects/combineball.mdl" );[/lua] Those are small, however, so I need to find out how to set Key Values... [editline]23rd January 2013[/editline] Or rather, I need to know how to scale the size of the combine ball.
[QUOTE=rocky123xo;39322066]Appreciate it, but I'm not sure what to do with that. That's why I'm asking for help :P[/QUOTE] Put it in server/gamemode_functions.lua at the end.
Meh, it doesn't matter... I can't get timer.Simple() to work within swep functions... [editline]23rd January 2013[/editline] Unless you can tell me a timer that works in the SWEP:SecondaryAttack() function... because timer.Simple(X, function blah end) just returns an error for me.
[QUOTE=fairy;39322321]Put it in server/gamemode_functions.lua at the end.[/QUOTE] Thanks
Is there a way to change the color of the [b]text[/b] in a DButton? Not the color of the button itself.
[lua] InfoPanel = vgui.Create( "DButton", DermaPanel ); -- Create the button InfoPanel:SetSize( 100, 30 ); -- Set the size of the button InfoPanel:SetPos( 50, 30 ); -- Set the position of the button InfoPanel:SetText( "Test" ); -- What does the button say (On top) InfoPanel:SetTextColor(Color(255,0,0,255)); -- What colour do you want the text (On top) [/lua]
Oh, that makes sense. The new wiki listed SetText as a method on a DButton but not SetTextColor.
[QUOTE=fairy;39323825]Oh, that makes sense. The new wiki listed SetText as a method on a DButton but not SetTextColor.[/QUOTE] It's just a dLabel parented to the button, so all of the dLabel functions will work with it.
[lua] function cam_door_test() surface.CreateFont( "cam_door_test_font", { font = "Arial", size = 105, weight = 800, antialias = true }) for k,v in pairs(ents.GetAll()) do if v:GetClass() == "prop_door" || v:GetClass() == "prop_door_rotating" then local angles = v:GetAngles(); local position = v:GetPos(); local offset = angles:Up() + angles:Forward() * -1.2 + angles:Right() * - 31; angles:RotateAroundAxis(angles:Forward(), 90); angles:RotateAroundAxis(angles:Right(), 90); angles:RotateAroundAxis(angles:Up(), 0); cam.Start3D2D(position + offset, angles, 0.1); draw.SimpleText("Door", "cam_door_test_font", 80.5, 46, Color(255, 255, 255, 255), 1, 1); draw.SimpleText("Door", "cam_door_test_font", 80.5, 46, Color(255, 255, 255, 255), 1, 1); cam.End3D2D(); end end end hook.Add("PostDrawOpaqueRenderables", "cam_door_test", cam_door_test) [/lua] For some reason, this causes my game to crash. Is this related to the hook at all? or is the content inside the function causing a crash. Note: The crash isn't instant, it's after around 60-90 seconds.
Well, first of all, try removing the surface.CreateFont from it. Put it outside of the function.
I do believe that has fixed my issue, why would creating a font inside a function cause it to crash me and not the server?
You only need to create a font once. Do you have any idea how many times PostDrawOpaqueRenderables is called? :v: It wouldn't crash the server because it's a clientside hook and function- why would the server need to create a font?
You're so wise and full of education. Haha yes now that you relay it back to me it makes complete sense. Thanks for the help bud.
Is there any way to change the size of the prop_combine_ball and still set its owner to self.Owner?
[QUOTE=luavirusfree;39326958]Is there any way to change the size of the prop_combine_ball and still set its owner to self.Owner?[/QUOTE] [url]https://developer.valvesoftware.com/wiki/Prop_combine_ball[/url]
I made a couple of alterations to the code but I'm still able to use the remover tool to remove the YTplayer when I'm set to a rank other than superadmin/admin. oddly the code works perfectly when using the weld tool. [lua]hook.Add("CanTool", "", function(pl, trace, tool) local ent = trace.Entity if ent:GetClass() == "gmod_playx" then if pl:IsSuperAdmin() or pl:IsAdmin() then return true else pl:Kick("Don't mess around with the YouTube Player") return false end end end) [/lua] Any ideas?
Can someone help me with a relative placement of 3d2d on a prop? I am using this: [lua] if string.lower(v:GetModel()) == string.lower("models/props_junk/PropaneCanister001a.mdl") then cam.Start3D2D( v:GetPos()+Vector(0,1,11), v:GetAngles()+Angle(0, 0, 0), .2 ) draw.DrawText("100%", "Default", 0, 0, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER ) cam.End3D2D() [/lua] But as it rotates, it adjusts the positioning.
[QUOTE=Magenta;39327047][url]https://developer.valvesoftware.com/wiki/Prop_combine_ball[/url][/QUOTE] You're not helping me. I've already looked through the key values and inputs. There seem to be none that actually change its size. I want to know how to make it the same size as the ones that come from the AR2, with lua.
[QUOTE=Science;39328279]Can someone help me with a relative placement of 3d2d on a prop? I am using this: [lua] if string.lower(v:GetModel()) == string.lower("models/props_junk/PropaneCanister001a.mdl") then cam.Start3D2D( v:GetPos()+Vector(0,1,11), v:GetAngles()+Angle(0, 0, 0), .2 ) draw.DrawText("100%", "Default", 0, 0, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER ) cam.End3D2D() [/lua] But as it rotates, it adjusts the positioning.[/QUOTE] Use [url]http://wiki.garrysmod.com/page/Classes/Entity/LocalToWorld[/url] [editline]23rd January 2013[/editline] [QUOTE=Bilsta1000;39328276]I made a couple of alterations to the code but I'm still able to use the remover tool to remove the YTplayer when I'm set to a rank other than superadmin/admin. oddly the code works perfectly when using the weld tool. [lua]hook.Add("CanTool", "", function(pl, trace, tool) local ent = trace.Entity if ent:GetClass() == "gmod_playx" then if pl:IsSuperAdmin() or pl:IsAdmin() then return true else pl:Kick("Don't mess around with the YouTube Player") return false end end end) [/lua] Any ideas?[/QUOTE] [lua] hook.Add("CanTool", "StopPlayXMessing", function(pl, trace, tool) local ent = trace.Entity if IsValid(ent) and ent:GetClass() == "gmod_playx" then if not pl:IsAdmin() then pl:Kick("Don't mess around with the YouTube Player") return false end end end) [/lua] Try that [editline]23rd January 2013[/editline] [QUOTE=luavirusfree;39328850]You're not helping me. I've already looked through the key values and inputs. There seem to be none that actually change its size. I want to know how to make it the same size as the ones that come from the AR2, with lua.[/QUOTE] Looked through the sourcecode for creating the ball. Looks like there needs to be a bind to "CPropCombineBall.SetRadius", which doesn't exist in garrysmod. However, it looks like the physics model is made using a simple sphere [url]http://wiki.garrysmod.com/page/Classes/Entity/PhysicsInitSphere[/url]. If you do that, then use [url]http://wiki.garrysmod.com/page/Classes/Entity/SetModelScale[/url] to scale it, you can probably get something accurate. However, things like explosion effects and such will not get changed, so it won't be perfect.
Sorry, you need to Log In to post a reply to this thread.