Reposting this, since I would like to know if anyone has any ideas. Thanks.
Get rid of that ugly ass material and rounded box in the bottom left hand corner.
Thanks for the constructive feedback.
Now how about the actual question?
Well he's right, the material still looks dumb and the bar just looks bad. Even if it didn't answer your question he was giving you the advice you need to hear.
Use the stencil buffer and draw the box first. Unless you want the particles to come out of the box rather than being behind it.
You should check if the particle material has ignorez in its vmt code.
I would like the particles to be coming from inside the box if I can help it, but behind it is still better than in front of it.
Edited:
I'll check real fast.
Doesn't seem like it. Anything else there that may be causing it?Code:"UnlitGeneric" { "$basetexture" "sprites/light_glow02" "$additive" "1" "$translucent" "1" "$vertexcolor" "1" }
Maybe it's just the way quads are rendered. Or you could try drawing it in another rendering hook.
Is there a way to detect if the mouse cursor is enabled?
I don't think there's a specific function for that. At least I didn't find it on the wiki. But you could probably do a simple detour.
gui.ScreenClickerEnabled = false local EnableScreenClicker_Old = gui.EnableScreenClicker function gui.EnableScreenClicker( enable ) EnableScreenClicker_Old( enable ) gui.ScreenClickerEnabled = enable end function gui.ScreenClickerEnabled() return gui.ScreenClickerEnabled() end
For your previous question, even if you figured it out, I advice you to use a matrix and rotate the matrix instead of each face individually. It's cleaner and easier to manage.
local mat = Matrix() mat:SetPos(box_pos) mat:SetAngles(box_ang) mat:Scale(box_scale) cam.PushModelMatrix(mat) *draw box with normals* cam.PopModelMatrix()
As for the emitter, do this
local emitter = ParticleEmitter(vector_origin) emitter:SetNoDraw(true) function DrawBox(pos) emitter:SetPos(pos) emitter:Draw() *box draw code* end
would be behind of course
Edited:
boolean vgui.CursorVisible()
Edited:
in what hook are you drawing it?
Is it possible to transmit bytecode (or whatever images use) over console commands? I'm trying to make a system that makes a screenshot using the jpeg command and uploads it to the server, but I'm getting incomplete data on the receiving end. I honesty can't wait for the net libary because concommands are terrible..
I tried making concommands handle binary data and trust me, it's not something you want to do. The overhead was like double the size of the actual data and even then it was not finished. I recon it'd have to be something like 5 times the size of the data in overhead for it to work fully.
Edited:
So yeah, wait for the net library.
you can use http.Get and store the data in the header, and have a socket on the server which receives it if you don't wanna wait
i havent really made anything in lua before
i want to make it so if a player ducks whilst touching the ground its instant
if pl:IsOnGround() then
self:SetDuckSpeed(0)
self:SetUnDuckSpeed(0) else
self:SetDuckSpeed(0.4)
self:SetUnDuckSpeed(0.3)
end
what am i doing wrong? its in player_extension on a blank fretta gamemode
Can we have the full code to the function/hook?
oh i just realised im putting it into function meta:OnSpawn()
what kind of function do i make so that whenever a player touches the ground that gets called?
and is that going to be a really dumb way to do it
Put it in Think.
For some reason I can't wrap my head around as to how to do this. I have a round system that I just finished but I want there to be a timer on the screen to count down the time between each round. I know it's with vgui I can do all that I just don't know how to get it to count down by minutes instead of numbers.
I want: 1 : 30 seconds.
Instead of 90 seconds.
How would I do this? Right now I have a simple timer waiting to start the next round but I need to output the time in mnutes and seconds.
Here is basically what I use in my HUD:
--time = the time left in the round local minutes = math.floor(time / 60); if (minutes < 1) then minutes = 0 end local seconds = math.floor(time % 60); if (seconds < 10) then seconds = "0"..seconds end local DisplayTime = minutes.." : "..seconds draw.SimpleTextOutlined(DisplayTime, "HUDNumber5",6, 6, Color(235, 235, 235, 255), 0, 0, 1, Color(25,25,25,255))
I will try to work with this, thanks a lot dude.
string.ToMinutesSeconds(time_in_seconds)
Edited:
Drawing behind would be better than nothing.
And the particles are being drawn in the ENT:Draw() hook. I tried setting the entity's render type to translucent and changing the Draw() to DrawTranslucent(), but it didn't really fix matters.
The draw order is
Code:function ENT:Draw() Particle Box end
Another way to handle this is this:
Code:output = string.format( "%02d:%02d", math.floor( seconds / 60 ), seconds % 60 )
Another alternate:
Putting in 90 would yield 1:30, for example.Code:output = os.date( "%M:%S", seconds )
im trying to make a function where
on func_door OnOpen
set self (the door that has been opened)
alpha 100 and set collision to passable for 5 seconds
Basically I'm trying to fix doors in a map so that players can pass through it without getting stuck when it opens (when a player first touches it), then when it closes after 5 seconds it returns to normal state.
I know the commands and stuff to do this but I have no idea how to structure that in lua, I tried a few different ways but I guess I just don't get it yet? I'm not sure how I can set the collision type of a door either so any help is greatly appreciated!
I'm trying to make a round system but have no idea where to start..
I made a round system that works off custom hooks, maybe this will give you some ideas feel free to use it, it works I used it in my Meteor defense game mode.
-- Gamemode Base Functions -- Rounds -- ======================================================================================== -- Hooks: -- PreRound : This is called every 5 seconds before the round starts (setup for a round) -- Variables : Players (table) , TimeUntilStart (number) -- -- Hook Example: Will print the time till round start for every player. -- hook.Add("PreRound", "myPreRound", function ( plys, time ) for k, v in pairs(plys) do v:ChatPrint("Round Starting in " .. tostring(time)) end ) -- -- RoundStart : This is called once when the timer for the round starts -- Variables : Players -- -- Hook Example: Will print "Round Started!" for every player. -- hook.Add("RoundStart", "myRoundStart", function ( plys ) for k, v in pairs(plys) do v:ChatPrint("Round Started!") end ) -- -- RoundEnd : This is called once as the round ends (timer hits) -- Variables : Players -- -- Hook Example: Will print "Round Finished!" for every player. -- hook.Add("RoundEnd", "myRoundEnd", function ( plys ) for k, v in pairs(plys) do v:ChatPrint("Round Finished!") end ) -- -- PostRound : This is called every 5 seconds after the round has ended ( for score stuff) -- Variables : Players, TimeUntilEnd -- -- Hook Example: Will print the time till PreRound start for every player. -- hook.Add("PreRound", "myPreRound", function ( plys, time ) for k, v in pairs(plys) do v:ChatPrint("Pre Round Will start In " .. tostring(time)) end ) -- Functions: -- * All time is in seconds -- SetPreRoundTime( time ) - Sets the Current Length of the PreRound -- GetPreRoundTime() - Gets the Current Length of the PreRound -- -- SetPreRoundInterval( time) -- Sets the Callback Rate on the PreRound -- GetPreRoundInterval() -- Gets the Callback Rate on the PreRound -- -- SetRoundTime( time ) - Sets the Length of the round (must be set before the Round starts, if set durring the round it will affect the next round) -- GetRoundTime() - Gets the Current Round Length -- -- SetPostRoundTime( time ) - Sets the length of the PostRound -- GetPostRoundTime() - Gets the length of the PostRound -- -- SetPostRoundInterval( time ) - Set the Callback Rate on the PostRound -- GetPostRoundInterval() - Gets the Callback Rate on the PostRound -- -- DidPreOnce() - Returns true if the Current PreRound has been called once -- DidPostOnce() - Return true if the Current PostRound has been called once -- -- StartRound() - forces round to start -- EndRound() - forces end of round -- -- RoundTimeRemaining() - Returns the time left in the round, or -1 if no round is running. -- if !SERVER then return end -- Cleanup incase we are reloading the script if timer.IsTimer("iPreRoundTimer") then timer.Remove("iPreRoundTimer") end if timer.IsTimer("iRoundTimer") then timer.Remove("iRoundTimer") end if timer.IsTimer("iPostRoundTimer") then timer.Remove("iPostRoundTimer") end -- Internal Variables with Default Values iPreRoundTime = 90 iPreRoundInterval = 5 iRoundTime = 120 iRoundStarted = -1 iPostRoundTime = 90 iPostRoundInterval = 5 iPlayers = {} iPreRan = false iPostRan = false -- Exposed Functions function DidPreOnce() return iPreRan end -- Used to Check if it the first PreRound call function DidPostOnce() return iPostRan end -- Used to Check if it's the first PostRound call function RoundPercentComplete() return 1 - (RoundTimeRemaining() / iRoundTime) end -- Returns the percent in decimal form of the round that is completed function RoundPercentCompleteR() return (RoundTimeRemaining() / iRoundTime) end -- Returns the percent in decimal form of the round that is completed -- Force Round Start function StartRound() timer.Remove("iPreRoundTimer") iRoundStart() end -- Force Round End function EndRound() timer.Remove("iRoundTimer") iRoundEnd() end -- Set/Get the length of the PreRound function SetPreRoundTime( time ) if (time >= 0) and !(time == nil) then iPreRoundTime = time end end function GetPreRoundTime() return iPreRoundTime end -- Check Time Remaining in the Round function RoundTimeRemaining() if iRoundStarted == -1 then return 0 end return iRoundTime - (CurTime() - iRoundStarted) end -- Set/Get Pre Round Call Interval function SetPreRoundInterval( time ) if (time >= 0) and !(time == nil) then iPreRoundInterval = time end end function GetPreRoundInterval() return iPreRoundInterval end -- Set/Get Round Time function SetRoundTime( time ) if (time >= 0) and !(time == nil) then iRoundTime = time end end function GetRoundTime() return iRoundTime end -- Set/Get Length of the Post Round. function SetPostRoundTime( time ) if (time >= 0) and !(time == nil) then iPostRoundTime = time end end function GetPostRoundTime() return iPostRoundTime end -- Set/Get PostRound Call Interval function SetPostRoundInterval( time ) if (time >= 0) and !(time == nil) then iPostRoundInterval = time end end function GetPostRoundInterval() return iPostRoundInterval end -- Quick Hooks they keep track of the players playing --hook.Add( "PlayerAuthed", "fanRoundPlayerAuthed", function ( ply, stid, uid ) table.insert( iPlayers, ply ) end ) --hook.Add( "PlayerDisconnected", "fanRoundPlayerDisconnected", function ( ply ) table.remove(iPlayers, IndexFromValue(iPlayers, ply)) end ) -- Internal Functions -- Cleans Bad Entries From the player table function iCleanTable( tbl ) if table.Count(tbl) < 1 then return end for k, v in pairs(tbl) do if !v:IsValid() or (v == nil) or (v == NULL) then table.remove(tbl, k) end end end -- Get an Index from a table by value function IndexFromValue( tbl, value ) for k,v in pairs(tbl) do if v == value then return k end end return nil end function iPreRound( time ) iPostRan = false if time >= iPreRoundTime then time = 0 timer.Remove("iPreRoundTimer") iRoundStart() else iPlayers = player.GetHumans() hook.Call( "PreRound", nil, iPlayers, iPreRoundTime - time) iPreRan = true timer.Remove("iPreRoundTimer") timer.Create("iPreRoundTimer", iPreRoundInterval, 0, iPreRound, time + iPreRoundInterval ) end end function iRoundStart() iPreRan = false iRoundStarted = CurTime() if !timer.IsTimer("iRoundTimer") then timer.Create("iRoundTimer", iRoundTime, 0, iRoundEnd ) end iPlayers = player.GetHumans() hook.Call( "RoundStart", nil, iPlayers ) end function iRoundEnd() iRoundStarted = -1 timer.Remove("iRoundTimer") iPlayers = player.GetHumans() hook.Call( "RoundEnd", nil, iPlayers ) iPostRound( 0 ) end function iPostRound( time ) if time >= iPostRoundTime then time = 0 timer.Stop("iPostRoundTimer") iPreRound( 0 ) else iPlayers = player.GetHumans() hook.Call( "PostRound", nil, iPlayers, iPostRoundTime - time) iPostRan = true timer.Remove("iPostRoundTimer") timer.Create("iPostRoundTimer", iPostRoundInterval, 0, iPostRound, time + iPostRoundInterval) end end -- After Everything is loaded start the round cycle iPreRound( 0 )
The code currently assumes that all players in the server are in the round, depending on what you are doing you will need to change the way players are managed.
-snip-
This problem has only occurred in the GM13 beta, but I dont know how to fix it.
This happens on all the map's I have tried with my gamemode.
![]()
Are you doing anything that changes your skybox in your code? Like moving env_sun etc?
Anyway, I'm finding no sense in this what-so-ever. I have tried adding another tool like this:
ToolList["Stuff"][1] = { Controls = "color", ItemName = "color", Command = "gmod_tool color", Text = "#Color" }
And this is one which was already made:
ToolList["Constraints"][1] = { Controls = "axis", ItemName = "axis", Command = "gmod_tool axis", Text = "#Axis" }
Yes, the Stuff menu does exist. The tool shows but there is no options for the tool's.
Well the tool itself works, however there is no options to change anything, it's just grey. (Floodmod).
As far as I remember, im not.
Mrkrabz: you probably need to supply the CPanel building tool, since I think color doesn't use txt files for controls.
I suppose there isn't an opposite function of GM:PlayerSpawnedProp( Player ply, String model, Entity ent )? Any tips on how to make one? e.g PlayerUndoProp or PlayerRemoveProp?
Hook OnEntityRemoved and compare to see if the ent is a prop_physics
I keep getting this error when the VGUI is meant to appear within my gamemode.
the code for the section isCode:Hook 'CharacterPanels' Failed: attempt to index local 'characterPanel' (a nil value)
local characterPanel = vgui.Create( "DFrame" ) characterPanel:SetPos( ScrW() / 4, ScrH() / 4 ) characterPanel:SetSize( 800, 570 ) characterPanel:SetTitle( "Character Creation" ) characterPanel:SetVisible( true ) characterPanel:SetDraggable( false ) characterPanel:ShowCloseButton( false ) characterPanel:Show()
and the hook code is
hook.Add( "InitPostEntity", "CharacterPanels", CreateCharacterPanels )
My Collapsible category won't display correct:
It seems as it's not opening rather just moving when you select it. This is the code of one of my category.
self.PropsCatD = vgui.Create( "DCollapsibleCategory" ) self.PropsCatD:SetSize( (self.LeftX - 10), self.MY ) self.PropsCatD:SetLabel( "Miscellaneus Props" ) self.PropsContD = vgui.Create( "DPanelList" ) self.PropsContD:EnableHorizontal(true) self.PropsContD:SetAutoSize( true ) self.PropsContD:SetSpacing( 5 ) self.PropsContD:SetPadding( 5 ) self.PropsCatD:SetContents( self.PropsContD ) self.PropsBackground:AddItem( self.PropsCatD )
self.MX = self:GetWide() self.MY = self:GetTall() self.LeftX = (math.floor((self.MX/2 - 10)/66) * 66) + 11
Hi, I've run into a question nobody is able to answer or take the time to answer. Using the TDMcars, some car material skins would jump from 12, suddenly to have 26 files. those extra 14 files don't exist. But this causes a problem, for e.g. If i use skin3.vmt it would apply skin1.vmt and wouldn't allow the use of some skins at all. I've got everything setup properly works fine with other cars except certain one's like the murcielago.
How would I get this camera to face my frontside? I tried reversing it and that didn't quite work.function MyCalcView(ply, pos, angles, fov) local view = {} view.origin = pos-(angles:Forward()*100) view.angles = angles view.fov = fov return view end hook.Add("CalcView", "MyCalcView", MyCalcView) hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply) return true end)