• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=Thiefdroid;52722642]How do I have quotes inside of a string? [code] print("[\"Name\"]") -- Not working -- I want it to print this: ["Name"] [/code][/QUOTE] [T]https://i.imgur.com/dECUCY2_d.jpg?maxwidth=640&shape=thumb&fidelity=medium[/t]
[QUOTE=code_gs;52722662][T]https://i.imgur.com/dECUCY2_d.jpg?maxwidth=64&shape=thumb&fidelity=medium[/t][/QUOTE] I got it to work after restarting gmod for some reason.
Is there any way to get the amount of weapons the player has in total? player:GetWeapons() does not work and is extremely random, it only updates once I have dropped all of my weapons. [B]Edit:[/B] I made a networked value that adds/removes/resets on death, drop and pickup etc. :)
[QUOTE=Thiefdroid;52724409]Is there any way to get the amount of weapons the player has in total? player:GetWeapons() does not work and is extremely random, it only updates once I have dropped all of my weapons. [B]Edit:[/B] I made a networked value that adds/removes/resets on death, drop and pickup etc. :)[/QUOTE] GetWeapons works fine. Just make sure you are taking into account that it is not a continuous table.
Is there a way to get a player's FOV setting? Since in advanced video options someone could drag it to anything between 75 and 100.
[QUOTE=DarkDragonLov;52724592]Is there a way to get a player's FOV setting? Since in advanced video options someone could drag it to anything between 75 and 100.[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetFOV]Player:GetFOV[/url]
[QUOTE=bigdogmat;52724606][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetFOV]Player:GetFOV[/url][/QUOTE] No... that only works when their FOV is still at their own setting. I want to know a way to get the setting, not the current FOV.
[QUOTE=DarkDragonLov;52724672]No... that only works when their FOV is still at their own setting. I want to know a way to get the setting, not the current FOV.[/QUOTE] There's no other way sadly
[QUOTE=DarkDragonLov;52724672]No... that only works when their FOV is still at their own setting. I want to know a way to get the setting, not the current FOV.[/QUOTE] Check the "fov_desired" convar
[QUOTE=bigdogmat;52724717]Check the "fov_desired" convar[/QUOTE] Alright. So would I do something like so? [code]local clFov = GetConVar( "fov_desired" ) local baseFov = clFov:GetFloat()[/code] fov_desired can be set as a float, right? For those itsy bitsy teeny weeny FOV adjustments that I'm sure nobody ever cares enough to tweak much? [editline]28th September 2017[/editline] Also... I suck at research, and I ask; What is the name / dir of the scope textures in CSS? [sp](I don't care about CS GO, even though I own it and only played it once [for what I feel is good reason, ew])[/sp] Or I'd much rather know if, and what, texture is used for the Half-Life 2 Zoom. I've tried as many search terms as I can think of to find it in CSS Hammer Editor, HL2 Hammer Editor, and even GM Hammer Editor. (I feel like Hammer isn't searching through all of the materials/textures there are)
[QUOTE=DarkDragonLov;52727735]Alright. So would I do something like so? [code]local clFov = GetConVar( "fov_desired" ) local baseFov = clFov:GetFloat()[/code] fov_desired can be set as a float, right? For those itsy bitsy teeny weeny FOV adjustments that I'm sure nobody ever cares enough to tweak much? [editline]28th September 2017[/editline] Also... I suck at research, and I ask; What is the name / dir of the scope textures in CSS? [sp](I don't care about CS GO, even though I own it and only played it once [for what I feel is good reason, ew])[/sp] Or I'd much rather know if, and what, texture is used for the Half-Life 2 Zoom. I've tried as many search terms as I can think of to find it in CSS Hammer Editor, HL2 Hammer Editor, and even GM Hammer Editor. (I feel like Hammer isn't searching through all of the materials/textures there are)[/QUOTE] It can be a float, but I believe the engine floors it to an int when it's actually applied. CS:S scope texture is "sprites/scope_arc", lens dust/dirt is "overlays/scope_lens". HL2 zoom is "vgui/zoom".
I have a model that is parented and attached to another model, but it's in the wrong position. I want to offset the position of the model that is parented. How do you go about that? I have this, but this of course doesn't work: [CODE] local model = ents.Create("prop_dynamic") model:SetModel("models/model.mdl") model:SetParent(entity) model:SetLocalPos(client:GetPos()-Vector(0,0,50)) --This doesn't work model:Fire("setparentattachment", entity:GetAttachments()[1].name) model:Spawn() [/CODE]
[QUOTE=code_gs;52727830]It can be a float, but I believe the engine floors it to an int when it's actually applied. CS:S scope texture is "sprites/scope_arc", lens dust/dirt is "overlays/scope_lens". HL2 zoom is "vgui/zoom".[/QUOTE] Thank you. Those textures are corners of the scope though. I thought there were also textures showing the whole package? Somewhat like this: [t]https://static.planetminecraft.com/files/resource_media/screenshot/1425/scope_lrg.jpg[/t]
[QUOTE=DarkDragonLov;52727971]Thank you. Those textures are corners of the scope though. I thought there were also textures showing the whole package? Somewhat like this: [t]https://static.planetminecraft.com/files/resource_media/screenshot/1425/scope_lrg.jpg[/t][/QUOTE] Probably just flipped 4 times
[QUOTE=MPan1;52727973]Probably just flipped 4 times[/QUOTE] Of course. But at the least, I don't think it was always this way. I know in the past I've done things with fullscreen overlays of one lens texture, or middle of the screen with black boxes on the sides... and I've forgotten the texture names. Maybe valve moved on and they use these corner textures now... but I swear the full scope textures existed.
[QUOTE=pilot;52727938]I have a model that is parented and attached to another model, but it's in the wrong position. I want to offset the position of the model that is parented. How do you go about that? I have this, but this of course doesn't work: [CODE] local model = ents.Create("prop_dynamic") model:SetModel("models/model.mdl") model:SetParent(entity) model:SetLocalPos(client:GetPos()-Vector(0,0,50)) --This doesn't work model:Fire("setparentattachment", entity:GetAttachments()[1].name) model:Spawn() [/CODE][/QUOTE] try [lua] local model = ents.Create("prop_dynamic") model:SetModel("models/model.mdl") model:SetParent(entity) model:SetPos(client:GetPos()-Vector(0,0,50)) --This doesn't work model:Spawn() model:Fire("setparentattachmentmaintainoffset ", entity:GetAttachments()[1].name, 0.01) [/lua]
[QUOTE=pilot;52727938]I have a model that is parented and attached to another model, but it's in the wrong position. I want to offset the position of the model that is parented. How do you go about that? I have this, but this of course doesn't work: [CODE] local model = ents.Create("prop_dynamic") model:SetModel("models/model.mdl") model:SetParent(entity) model:SetLocalPos(client:GetPos()-Vector(0,0,50)) --This doesn't work model:Fire("setparentattachment", entity:GetAttachments()[1].name) model:Spawn() [/CODE][/QUOTE] Firstly, local positions refer to the entity's position compared to its parent -- you shouldn't be adding on the parent's position. The actual problem is that you are calling setparentattachment, though: that will always override the child entity's position. Choose one or the other. [editline]29th September 2017[/editline] [QUOTE=DarkDragonLov;52727981]Of course. But at the least, I don't think it was always this way. I know in the past I've done things with fullscreen overlays of one lens texture, or middle of the screen with black boxes on the sides... and I've forgotten the texture names. Maybe valve moved on and they use these corner textures now... but I swear the full scope textures existed.[/QUOTE] You are not referring to the CS:S scope then -- Valve has always just flipped the texture four times: [url]https://github.com/LestaD/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/cstrike/cs_hud_scope.cpp#L105-L203[/url]
[QUOTE=code_gs;52728685]You are not referring to the CS:S scope then -- Valve has always just flipped the texture four times: [url]https://github.com/LestaD/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/cstrike/cs_hud_scope.cpp#L105-L203[/url][/QUOTE] The suit-zoom overlay is the same way, too. Kind of a pain, cus DrawTexturedRectRotated never [i]quite[/i] aligns properly...
[QUOTE=Luni;52728883]The suit-zoom overlay is the same way, too. Kind of a pain, cus DrawTexturedRectRotated never [i]quite[/i] aligns properly...[/QUOTE] Do you have any examples? I've never had any issues, personally.
[QUOTE=code_gs;52729014]Do you have any examples? I've never had any issues, personally.[/QUOTE] I went back and looked at the 6-month-old code that had this issue and it turns out I'm retarded and forgot to automatically floor my coordinates :vs:
-snip-
use self:GetRight(), not Vector(i*x,0,0)
[QUOTE=gonzalolog;52730698]use self:GetRight(), not Vector(i*x,0,0)[/QUOTE] Could you elaborate a bit more ? Am I going to get the vector of the previous seat or what? I'm confused
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetRight]Entity:GetRight[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetUp]Entity:GetUp[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetForward]Entity:GetForward[/url]
[QUOTE=gonzalolog;52730744][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetRight]Entity:GetRight[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetUp]Entity:GetUp[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetForward]Entity:GetForward[/url][/QUOTE] Awesome! Thank you so much :)
[QUOTE=DahDestroyer;52730639]-snip-[/QUOTE] Please do not -snip- your questions -- other people might have the same one and you are robbing them of an answer.
[QUOTE=code_gs;52730829]Please do not -snip- your questions -- other people might have the same one and you are robbing them of an answer.[/QUOTE] My bad sorry, I thought it was a stupid question as I wasn't aware of how GetForward() etc worked :(
Anyone knows if i can grab entities as we can do with small props? Edit: Found this function, i'm dumb [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/PickupObject]Player:PickupObject[/url]
-snip-
[QUOTE=RasmusG5;52738076]so when i spawn my entity in my gamemode i cant use it but i can use it in sandbox also i didnt get any errors what code i should post?[/QUOTE] What does "I cant use it" mean? You can spawn it but not hit "E" on it? or it doesn't spawn at all? Either way post your init.lua and shared.lua file for the entity.
Sorry, you need to Log In to post a reply to this thread.