• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
I'm having a problem with my vtf's freaking out when I look a certain direction. I know i've seen someone with the issue before, but I can't seem to find the thread (must be wording something wrong) Any help with this tiny error please? [video=youtube;6zx-63Bv6YU]https://www.youtube.com/watch?v=6zx-63Bv6YU[/video] [code] surface.SetMaterial(Material("vanilla/hud/vanilla_health")) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(10,10,48,48) [/code] VTF Edit Settings: [img]https://i.imgur.com/c0oW0C2.png[/img]
[QUOTE=Richtofen;51807522]I'm having a problem with my vtf's freaking out when I look a certain direction. I know i've seen someone with the issue before, but I can't seem to find the thread (must be wording something wrong) Any help with this tiny error please?[/QUOTE] Is your shader UnlitGeneric? Edit: At first I thought it was just darkening. Post your material code and we can help.
[QUOTE=TehBigA;51807549]Is your shader UnlitGeneric? Edit: At first I thought it was just darkening. Post your material code and we can help.[/QUOTE] Edited first post with code and screenshot of vtf edit. Any help is much appreciated!
Anyone know of an algorithm for RT Scope sensitivity? I'm trying to make it automatically scale, so the player's view will shift the same number of pixels regardless of the FOV. This is what I do for normal 2D scopes: [code] function TFA.CalculateSensitivtyScale( fov_target, fov_src ) --Ironsights FOV, player FOV ( in order ) resrat = ScrW() / ScrH() fov_og = fov_src or TFADUSKFOV or LocalPlayer():GetFOV() return math.atan( resrat * math.tan(math.rad( fov_target / 2 ) ) ) / math.atan( resrat * math.tan( math.rad( fov_og / 2) ) ) end [/code] I'm just not sure how to apply it for RT scopes. Using the ironsights FOV as my target makes aiming insane, whereas using the RT fov typically makes it much too slow.
[QUOTE=TehBigA;51807549]Is your shader UnlitGeneric? Edit: At first I thought it was just darkening. Post your material code and we can help.[/QUOTE] This was actually the issue. Changed my vmt from LightMappedGeneric to UnlitGeneric!
How do I rotate an angle around and axis that is off center? Code if for a floor turret sent. I'm trying to get the gun part to rotate in place but because its X axis is off center in the SetPos() then attempting to rotate the Y axis in SetAngles() results in a rotation that is off center from the parent. [code] gun:SetPos(self:GetPos() + Vector(10,0,20)) -- Spawn in center + 10 units back on the X from the parent prop. gun:SetAngles(self:GetAngles() + Angle(-90,180,0)) -- Changing the Y axis rotates off center from the parent prop. [/code] EDIT: Image reference of Combine sniper which is parented to the train wheel. [IMG]http://puu.sh/tYbg0/6f6d13b831.png[/IMG]
[QUOTE=Richtofen;51807572]Edited first post with code and screenshot of vtf edit. Any help is much appreciated![/QUOTE] The VMT is the important one in this case. Post that too. Edit: Missed the second post. Glad it worked. [editline]11th February 2017[/editline] @RenTec: I'm guessing you want to rotate around the gun's local Z axis so here is an example [code] local ang = gun:GetAngles() -- Get current angle ang:RotateAroundAxis(gun:Up(), <DEGREES>) -- Modifies ang, does not return copy gun:SetAngles(ang) -- Set angle after modification [/code]
[QUOTE=MPan1;51807019]Stupid question, but is it possible to make the skybox have a [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/RenderView]render.RenderView[/url] texture?[/QUOTE] something along the lines of: [lua]local rendering = false hook.Add("PreDrawSkyBox", "Custom Skybox", function () if rendering then return end -- prevent unintended endless recursion rendering = true render.RenderView(yourview) -- I assume you want to use a custom view here that's different from the player's view, otherwise the only thing this will accomplish is halving your FPS rendering = false return true end)[/lua] untested
[QUOTE=NeatNit;51811373]something along the lines of: [lua]local rendering = false hook.Add("PreDrawSkyBox", "Custom Skybox", function () if rendering then return end -- prevent unintended endless recursion rendering = true render.RenderView(yourview) -- I assume you want to use a custom view here that's different from the player's view, otherwise the only thing this will accomplish is halving your FPS rendering = false return true end)[/lua] untested[/QUOTE] Thanks for this. It sort of works but I'm looking for a way to only hide the bits that are actually sky, this method hides parts that aren't sky, for example, the hills in the skybox of gm_flatgrass. It also hides the viewmodel. Is there anything that could be done? [editline]12th February 2017[/editline] I tried using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostDraw2DSkyBox]GM:PostDraw2DSkyBox[/url] which seems to work but I still have the problem of it hiding the viewmodel and doing other weird things. It also crashes PAC3. [editline]12th February 2017[/editline] This is what I'm doing at the moment by the way: [CODE] local rendering = false hook.Add( "PostDraw2DSkyBox", "Awful Skybox", function() if !rendering then rendering = true render.RenderView( { origin = Vector( 0, 0, 0 ), -- just for testing angles = Angle( 0, 0, 0 ), x = 0, y = 0, w = ScrW(), h = ScrH(), } ) rendering = false end end ) [/CODE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/ClearDepth]render.ClearDepth[/url] maybe? [editline]12th February 2017[/editline] by the way, you don't have to specify x, y, w, h if you just want to fill the screen.
I'm looking for a way to track sprays when I'm not on my server. I noticed that servers store uploaded sprays in .dat files, in download/user_custom. The filename seems to be a hash of the actual file. Is there a way to tell which player sprayed which file?
How would I add multiple autocomplete arguments to a concommand? I can't seem to find any info about it anywhere.
[QUOTE=txike;51812504]How would I add multiple autocomplete arguments to a concommand? I can't seem to find any info about it anywhere.[/QUOTE] With spaces. [code] --"args" is an array concommand.Add("test",function(ply,cmd,args) print("You gave ",#args," arguments!") print(table.concat(args,"\n")) end) [/code] each argument is separated with a space, but obeys quotations. [code] test arg1 arg2 arg 3 [/code] will print [code] You gave 4 arguments! arg1 arg2 arg 3 [/code] but [code] test "arg1 arg2" "arg 3" [/code] will print [code] You gave 2 arguments! arg1 arg2 arg 3 [/code] *Totally untested, but I'm pretty sure this is how it works.
[QUOTE=Apickx;51812804]With spaces. [code] --"args" is an array concommand.Add("test",function(ply,cmd,args) print("You gave ",#args," arguments!") print(table.concat(args,"\n")) end) [/code] each argument is separated with a space, but obeys quotations. [code] test arg1 arg2 arg 3 [/code] will print [code] You gave 4 arguments! arg1 arg2 arg 3 [/code] but [code] test "arg1 arg2" "arg 3" [/code] will print [code] You gave 2 arguments! arg1 arg2 arg 3 [/code] *Totally untested, but I'm pretty sure this is how it works.[/QUOTE] I'm talking about autocomplete. [url]http://wiki.garrysmod.com/page/concommand/AutoComplete[/url]
[QUOTE=txike;51812851]I'm talking about autocomplete. [url]http://wiki.garrysmod.com/page/concommand/AutoComplete[/url][/QUOTE] you must specify a function to do your auto complete, in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/concommand/Add]concommand.Add[/url] it even has a link to an autocomplete tutorial linked on that page. it looks like you'll need to build a table inside the function and return it based off what they type in so if it was some_command bir you could return the options that start with bir, some_command bird some_command birds if they already typed bird and a space some_command bird you could return a list like some_command bird kill some_command bird fly
Removed.
Your above code gives me errors and doesn't even allow me to open the menu (Assuming I'm copy pasting your code and putting it in a file in lua/autorun/) [CODE] hook.Add("OnPlayerChat", "ThisOpensTheMenu", function(ply, strText, bTeam, bDead) strText = string.lower(strText) if (strText == "!menu") then local adminMenu = vgui.Create("DFrame") adminMenu:SetSize(400,300) adminMenu:SetVisible(false) adminMenu:Center() adminMenu:SetTitle("Menu") adminMenu:MakePopup() adminMenu.Paint = function(s, w, h) draw.RoundedBox(5, 0, 0, w, h,Color(0, 60, 60)) end adminMenu:SetVisible(true) return true end end) [/CODE] This seems to work for me, opening/closing like there's no tommorow :v Fukin fixed a bit
[QUOTE=Failure;51813792]Your above code gives me errors and doesn't even allow me to open the menu (Assuming I'm copy pasting your code and putting it in a file in lua/autorun/) [CODE] hook.Add("OnPlayerChat", "ThisOpensTheMenu", function(ply, strText, bTeam, bDead) strText = string.lower(strText) local adminMenu = vgui.Create("DFrame") adminMenu:SetSize(400,300) adminMenu:SetVisible(false) adminMenu:Center() adminMenu:SetTitle("Menu") adminMenu:MakePopup() adminMenu.Paint = function(s, w, h) draw.RoundedBox(5, 0, 0, w, h,Color(0, 60, 60)) end if (strText == "!menu") then adminMenu:SetVisible(true) return true end end) [/CODE] This seems to work for me, opening/closing like there's no tommorow :v[/QUOTE] That's because it's clientside code -- it should go in lua/autorun/client. And now you're creating a menu every time the player chats anything, which is essentially a memory leak in this case.
[QUOTE=Fantym420;51813076]you must specify a function to do your auto complete, in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/concommand/Add]concommand.Add[/url] it even has a link to an autocomplete tutorial linked on that page. it looks like you'll need to build a table inside the function and return it based off what they type in so if it was some_command bir you could return the options that start with bir, some_command bird some_command birds if they already typed bird and a space some_command bird you could return a list like some_command bird kill some_command bird fly[/QUOTE] Checking if it ends in a space won't really do much for me as my arguments for the concommand have spaces in.
[QUOTE=code_gs;51814028]That's because it's clientside code -- it should go in lua/autorun/client. And now you're creating a menu every time the player chats anything, which is essentially a memory leak in this case.[/QUOTE] Holy fucking shit you're right, sorry! Wouldn't it be better to shove it inside some file and create it when the player joins? Granted it's contents are not going to change that way it would be created only once and then shown/hidden when needed. I don't have much experience with derma windows, I only know my way around java's swing and javafx shit so I might be wrong here.
[QUOTE=txike;51814080]Checking if it ends in a space won't really do much for me as my arguments for the concommand have spaces in.[/QUOTE] If an argument isn't inside quotes, spaces are treated as separators. The point in that example would be that you want to check the first index, and then return the table of arguments that can be used.
[QUOTE=NeatNit;51811784][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/ClearDepth]render.ClearDepth[/url] maybe? [editline]12th February 2017[/editline] by the way, you don't have to specify x, y, w, h if you just want to fill the screen.[/QUOTE] I shoved that function all over the place but sadly no matter where I shove it, it doesn't seem to have an effect. Thanks for the tip by the way
Is it default that you don't hear footsteps anymore at slow speed?
[CODE]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/hunter/blocks/cube025x025x025.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetColor(Color(90,90,90)) local phys = self.GetPhysicsObject() if phys:IsValid() then phys:Wake() end end function ENT:Use(a , c) c:SetHealth(c:Health() + 1) if c:Health() >= 101 then c:SetHealth(1) c:PrintMessage(HUD_PRINTTALK,"How dare you, "..c:Nick()" abuse a power granted by the gods!") end end[/CODE] I am using this code but receiving this error. [CODE][ERROR] lua/entities/testent/init.lua:15: Tried to use a NULL entity! 1. GetPhysicsObject - [C]:-1 2. unknown - lua/entities/testent/init.lua:15 3. Spawn - [C]:-1 4. SpawnFunction - gamemodes/base/entities/entities/base_entity/init.lua:70 5. Spawn_SENT - gamemodes/sandbox/gamemode/commands.lua:651 6. unknown - gamemodes/sandbox/gamemode/commands.lua:716 7. unknown - lua/includes/modules/concommand.lua:54[/CODE] Any help is appreciated!
It should be self:GetPhysicsObject () with a colon
[code]local phys = self.GetPhysicsObject()[/code] This is the problem. [sp]Dot is not the correct symbol there[/sp]
[QUOTE=Robotboy655;51816994][code]local phys = self.GetPhysicsObject()[/code] This is the problem. [sp]Dot is not the correct symbol there[/sp][/QUOTE] Ahh, I am indeed retarded, ty vmuch
Is there any way to see if a SteamID is valid, without requiring that the player it may belong to being in the server? If not, would a simple regex work?
[QUOTE=Mista_Epic;51829079]Is there any way to see if a SteamID is valid, without requiring that the player it may belong to being in the server? If not, would a simple regex work?[/QUOTE] For it being ~theoretically valid~, yes, a regex could work. For checking to see if it actually belongs to someone, could try converting it to a steamid64 and then seeing if valve's official servers return a valid profile: steamcommunity.com/profiles/[steamid64] check the fetch result for any errors, and if not, assume it's true
[QUOTE=TFA;51829094]For it being ~theoretically valid~, yes, a regex could work. For checking to see if it actually belongs to someone, could try converting it to a steamid64 and then seeing if valve's official servers return a valid profile: steamcommunity.com/profiles/[steamid64] check the fetch result for any errors, and if not, assume it's true[/QUOTE] So I should use a combination of the two then? Use the Regex to see if the SteamID is correctly formatted, then convert it to a 64, and then fetchm if so, would [code]STEAM_\d:\d:(\d*)[/code] work for a regex? EDIT: After looking at the format for SteamIDs, I discovered the second "digit" can also be 10. The first digit can also only be between 0 and 5. So would this work better? [code]STEAM_[0-5]:(10|[0-9]):(\d*)[/code] EDIT 2: The last number can only be 32 bits, and the max value for 32 bits has 10 digits. Could I even further optimize the regex to [code]STEAM_[0-5]:(10|\d):\d{1,10}[/code]?
Sorry, you need to Log In to post a reply to this thread.