• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=_FR_Starfox64;46489048]Was wondering if what I was doing was the right way to override a weapon's function [lua] local SWEP = {} function SWEP:LolFunction() end weapons.Register(SWEP, "fas2_base") [/lua] [/QUOTE] From the source code of weapons.Register it looks like it will clear entire SWEP table. This should do: [lua] local weap = weapons.GetStored("fas2_base") function weap:LolFunction() end weapons.Register(weap, "fas2_base") -- Optional. But will reload already spawned weapons of this class [/lua]
[QUOTE=Scarface3353;46486698]How to make a build/kill mode? I mean, like 2 minutes to build something, and then 2 minutes to kill and survive on it[/QUOTE] That's a really broad question. What exactly do you need help with?
How can I have like the last 4-6 messages in chat be posted to something clientside without PlayerSay (unless I'm missing something and PlayerSay is shared) I only want it for one player also.
Where is the spray cooldown timer controlled? I can't find it anywhere. Alternatively can I change it from my server.cfg?
[QUOTE=BlaBlaAccount;46492615]Where is the spray cooldown timer controlled? I can't find it anywhere. Alternatively can I change it from my server.cfg?[/QUOTE] decalfrequency
[QUOTE=LUModder;46492612]How can I have like the last 4-6 messages in chat be posted to something clientside without PlayerSay (unless I'm missing something and PlayerSay is shared) I only want it for one player also.[/QUOTE] use [URL="http://wiki.garrysmod.com/page/Player/ChatPrint"]Player:ChatPrint( string message )[/URL] it prints to the players chat window.
[QUOTE=Fantym420;46492921]use [URL="http://wiki.garrysmod.com/page/Player/ChatPrint"]Player:ChatPrint( string message )[/URL] it prints to the players chat window.[/QUOTE] I don't need it to ChatPrint, I need it to print to a 3D2D linked to an entity.
[QUOTE=LUModder;46492976]I don't need it to ChatPrint, I need it to print to a 3D2D linked to an entity.[/QUOTE] [del]Are you trying to make a 3D2D chatbot? In the 3D2D panel use the [URL="http://wiki.garrysmod.com/page/GM/ChatText"]ChatText[/URL] hook to update the text.[/del] EDIT: PlayerSay is server, ChatText is clientsided. EDIT2: Yeah I'm dumb... OnPlayerChat works for regular chat ChatText works for when the server runs ply:ChatPrint()
[QUOTE=Pandaman09;46493005]Are you trying to make a 3D2D chatbot? In the 3D2D panel use the [URL="http://wiki.garrysmod.com/page/GM/ChatText"]ChatText[/URL] hook to update the text. EDIT: PlayerSay is server, ChatText is clientsided.[/QUOTE] I've read before that ChatText doesn't run for player chat. And even if it works, [URL="http://wiki.garrysmod.com/page/GM/OnPlayerChat"]OnPlayerChat[/URL] still seems to be better for this case.
Getting weird error for some reason with my cam.Start3D2D. [lua] Player [5][Flex] ERR: [Hook] PostDrawOpaqueRenderables:verbal_chatmonitor removed: [0:0:58178275]Flex:2: bad argument #2 to 'Start3D2D' (Angle expected, got no value) ---- hook.Add("PostDrawTranslucentRenderables","verbal_monitorchat",function() local scale = ply:GetModelScale() local zscl = scale if scale<1 then scale = 0.4+scale*0.6 zscl = 0.7+scale*0.3 end local head_pos = get_head_pos(ent) + ent:GetUp() * (offset * zscl) local h_offset = h * spacing cam.Start3D2D(head_pos,Angle(0,0,90),1) draw_text(verbal_chattext, color_white, -(w/2), h_offset) cam.End3D2D() end) [/lua]
Is there a way to check if a vehicle crosses over a certain vector or "line"?
[QUOTE=ds;46497522]Is there a way to check if a vehicle crosses over a certain vector or "line"?[/QUOTE] if vehicle_pos * line_normal > line_pos * line_normal then Untested, not sure if my math is right
-snip ninja'd-
You'd need to have a sort of round controller ( currently timers aren't stable but timers would make a valid option too ). basically each time a timer runs you'd set up the next one; using a round system would give more flexibility though.
[code]if util.IntersectRayWithOBB( point, vector_up, vehiclepos, vehicleangle, vehicle:OBBMins( ), vehicle:OBBMaxs( ) ) then [/code] Perhaps? [url=http://wiki.garrysmod.com/page/util/IntersectRayWithOBB]IntersectRayWithOBB[/url] returns nil / false for the hitpos if it doesn't hit.
How to get a spawned entity to freeze? Mine never seem to freeze! [lua] local gun = ents.Create("mygun") gun:SetPos( Vector(-1700, -400, -7.968750) ) gun:Spawn() gun:SetMoveType( MOVETYPE_NONE ) [/lua]
[QUOTE=jakej78b;46498410]How to get a spawned entity to freeze? Mine never seem to freeze! [lua] local gun = ents.Create("mygun") gun:SetPos( Vector(-1700, -400, -7.968750) ) gun:Spawn() gun:SetMoveType( MOVETYPE_NONE ) [/lua][/QUOTE] Here's what I do to entities that need to remain in one location and never move; disable motion on the physics object and weld it to the world. [code]// Prevent object from moving, and weld object to world - prevents invisible props from moving. if( ent:IsValid( ) && ent:GetPhysicsObject( ):IsValid( ) ) then ent:GetPhysicsObject( ):EnableMotion( false ); constraint.Weld( ent, game.GetWorld( ) ); end [/code]
[QUOTE=jakej78b;46498410]How to get a spawned entity to freeze? Mine never seem to freeze! [lua] local gun = ents.Create("mygun") gun:SetPos( Vector(-1700, -400, -7.968750) ) gun:Spawn() gun:SetMoveType( MOVETYPE_NONE ) [/lua][/QUOTE] you need to get the physics object of the entity - [URL="http://wiki.garrysmod.com/page/Entity/GetPhysicsObject"]Entity:GetPhysicsObject( )[/URL] and make sure it's not nil, then use - [URL="http://wiki.garrysmod.com/page/PhysObj/EnableMotion"]PhysObj:EnableMotion( boolean enable )[/URL] and that'll freeze the physics of the object. hope that helps.
[QUOTE=Fantym420;46498487]you need to get the physics object of the entity - [URL="http://wiki.garrysmod.com/page/Entity/GetPhysicsObject"]Entity:GetPhysicsObject( )[/URL] and make sure it's not nil, then use - [URL="http://wiki.garrysmod.com/page/PhysObj/EnableMotion"]PhysObj:EnableMotion( boolean enable )[/URL] and that'll freeze the physics of the object. hope that helps.[/QUOTE] These are weapons, so I don't think the weld option would be right, unless the weld is undone when the weapon is picked up. I actually tried to weld it, but they won't freeze before they weld so you can still move them... This is annoying. Is there a way to create physobj or is it just there? [lua] local gun = ents.Create("mygun") gun:SetPos( Vector(-1828.031250, 1343.940552, 200.031250) ) gun:Spawn() local phys = gun:GetPhysicsObject( ) if phys then phys:EnableMotion( false ) end [/lua] Still no luck with that code, so what do i do if the physobject IS nil?
[QUOTE=zeaga;46492412]That's a really broad question. What exactly do you need help with?[/QUOTE] What i need right now is a flood-like timed system (you know, build time, get on your boat/base time, fight/survive time, round end time.), but instead of FFA, it's team based, with 1 team frozen while the other builds.
How do I draw a textured Polygon?
Trying to make this gun not remove itself if the player has pressed the drop weapon key (which executes the command to drop the gun) Otherwise if the player dies and it automatically drops from his corpse then I want it to be removed. But I'm having trouble getting it to work. [code] function SWEP:OnDrop() if self.Owner:RunConsoleCommand("ttt_dropweapon") then return end self:Remove() end [/code] Currently I don't even spawn with it. I have to give myself the weapon through console.
How to reskin Derma Panels, like scrollbar(btndown,btnup,btngrip) or Slider(Slider knobb and etc.), without usage skins?
[QUOTE=Author.;46500808]How do I draw a textured Polygon?[/QUOTE] Set the u and v segments of each part of the polygon. Example, rectangle that will take a texture: [code]// // Makes a rectangle Poly. Changed format from start x, end x, start y, end y into easier x, y, w, h. - Josh 'Acecool' Moser // function poly:MakeRect( _x, _y, _w, _h, _textureWidth, _textureHeight ) // U is how many times the texture should repeat along the X local _u = ( ( ( _x + _w ) - _x ) / ( _textureWidth || 1 ) ); // V is how many times the texture should repeat along the Y local _v = ( ( ( _y + _h ) - _y ) / ( _textureHeight || 1 ) ); // The creation of the Poly. local _poly = { { x = _x, y = _y, u = 0, v = 0 }, // Top Left { x = ( _x + _w ), y = _y, u = _u, v = 0 }, // Top Right { x = ( _x + _w ), y = ( _y + _h ), u = _u, v = _v }, // Bottom Right { x = _x, y = ( _y + _h ), u = 0, v = _v }, // Bottom Left }; return _poly; end // // Creates a circle poly which accepts a texture - Josh 'Acecool' Moser // function poly:MakeCircle( _x, _y, _r, _points, _textureScale ) // U is how many times the texture should repeat along the X local _u = ( _x + _r * 1 ) - _x; local _u = 1; // V is how many times the texture should repeat along the Y local _v = ( _y + _r * 1 ) - _y; // local _textureScale = _textureScale || 0.099; local _slices = ( 2 * math.pi ) / _points; local _poly = { }; for i = 0, _points - 1 do local _angle = ( _slices * i ) % _points; local x = _x + _r * math.cos( _angle ); local y = _y + _r * math.sin( _angle ); // i / _points // i * _angle / _points table.insert( _poly, { x = x; y = y; u = _u; v = ( ( i * _angle / _points ) * _textureScale ) } ); end return _poly; end[/code] These are going to be added to my dev base in the next update ( probably after networking because I'm working on a caching system for polys so they can be called how-ever )... Hopefully this helps a bit. [editline]16th November 2014[/editline] [QUOTE=UnkN;46500948]How to reskin Derma Panels, like scrollbar(btndown,btnup,btngrip) or Slider(Slider knobb and etc.), without usage skins?[/QUOTE] Overwrite the Paint function and draw them manually. Using skins is the easiest way because there are already functions pre-defined which reads the textures from a bitmap, plus coloring for some... [editline]16th November 2014[/editline] [QUOTE=BlaBlaAccount;46500944]Trying to make this gun not remove itself if the player has pressed the drop weapon key (which executes the command to drop the gun) Otherwise if the player dies and it automatically drops from his corpse then I want it to be removed. But I'm having trouble getting it to work. [code] function SWEP:OnDrop() if self.Owner:RunConsoleCommand("ttt_dropweapon") then return end self:Remove() end [/code] Currently I don't even spawn with it. I have to give myself the weapon through console.[/QUOTE] So if the player dies, you want the weapons removed? Use PlayerDeath hook and use _victim:GetWeapons( ) and SafeRemoveEntity all in the table for that case. If a player drops the weapon, then the weapon won't be removed, or do you want the weapon removed?
Trying to put some derma ontop of render.RenderView, but it just goes behind it. Any methods?
So I'm using Swep Construction Kit and basically have a crowbar as a base, then a meat-hook model attached. How would I make it so the crowbar world/view model are invisible while keeping the meat-hook one? I looked on the wiki to hide view/world model but ended up doing both
[QUOTE=NiandraLades;46504951]So I'm using Swep Construction Kit and basically have a crowbar as a base, then a meat-hook model attached. How would I make it so the crowbar world/view model are invisible while keeping the meat-hook one? I looked on the wiki to hide view/world model but ended up doing both[/QUOTE] You could scale the crowbar model down, so that it can't be seen.
Could I do that without messing around with the actual mdl file? [editline]16th November 2014[/editline] I deserve that dumb, to be honest; Sorry, could you explain more?
[QUOTE=NiandraLades;46505218]Could I do that without messing around with the actual mdl file? [editline]16th November 2014[/editline] I deserve that dumb, to be honest; Sorry, could you explain more?[/QUOTE] Sorry, I thought you could do that. Never mind what I said above, just tested it and what I suggested isn't possible.
-snip- rate me late, or fapping
Sorry, you need to Log In to post a reply to this thread.