• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
Would that lag if I vector.Dot all players? I should've specified what the problem was, I'm trying to look for a way to check if another player can see an unspecified player. Unspecified as in I can't just say "oh hey is x player looking at y player" but only say "is xplayer looking at a player, if so then who?"
[QUOTE=GGG KILLER;47011692]I got 2 questions: 1. Does someone know how to make a 3D2D clickable button? 2. Is the Initialize hook ran after the map is loaded and the map-based props are spawned?[/QUOTE] 1. Do a trace when a player presses E and check if it intercepts 2. No, use InitPostEntity
[QUOTE=Mista Tea;47005727][URL="http://wiki.garrysmod.com/page/SANDBOX/CanProperty"]SANDBOX:CanProperty[/URL] has an example exactly for your issue. There is also [URL="http://wiki.garrysmod.com/page/ENTITY/CanProperty"]ENTITY:CanProperty[/URL], depending on your needs. [editline]24th January 2015[/editline] Is 'station' meant to be Ebola, or are you declaring that elsewhere? Assuming the latter since your check is for if station [I]isn't[/I] valid, unless that's the problem itself.[/QUOTE] The code was debugged a lot, and I posted the wrong code. For some reason, its working now without me touching anything. It might be the website :0 (it wasnt youtube originally rubat.)
[QUOTE=bobbleheadbob;47011380]Damn it, !cake. I wasn't expecting Calculus. What exactly is [I]t[/I], and what kind of values do [I]linex [/I]and [I]liney [/I]return? I'm guessing [I]t [/I]is a constant representing length, and [I]linex [/I]and [I]liney [/I]are the end points of the tangent at length [I]t[/I] away from the contact point. Like this? [t]http://s27.postimg.org/pqovg1ucz/tangent.png[/t][/QUOTE] (linex, liney) is a [url=https://en.wikipedia.org/wiki/Parametric_equation]parametric equation[/url] in t, just like your ellipse (touchx, touchy) is defined by a parametric equation in ang. [thumb]https://dl.dropboxusercontent.com/u/7290193/Screenshots/Facepunch/ellipsetangent.png[/thumb]
so... i kinda know why this: [lua] [ERROR] attempt to compare string with number 1. sort - [C]:-1 2. SortedPairs - lua/includes/extensions/table.lua:544 3. OnToggle - addons/braxnetrp-dev/lua/brax/sh_!braxf4.lua:392 4. Toggle - lua/vgui/dcategorycollapse.lua:220 5. DoClick - lua/vgui/dcategorycollapse.lua:25 6. unknown - lua/vgui/dlabel.lua:206 [/lua] is happening, but why do i fix it? i just want to sort that array, but it's got mixed values, including tables [B]edit[/B] well i guess it's not the problem really, i don't even need those numerical keys, i just can't get rid of em [editline]26th January 2015[/editline] the [I]real[/I] problem is sorting by value, "attempt to compare two table values"
My post was very bloated so I guess many people missed the actual question in it, which was: [QUOTE=Neat-Nit;47009210]one of the things I wanted to do is to remove an undo from the table without actually removing its entities (the goal is that a player will be able to undo their constraints, but not their spawns). Is there a way to do this?[/QUOTE] If anyone has any idea how to do this... Shoot. Thanks!
Override the undo library to stop it from inserting the entity info.
[QUOTE=scottd564;47013756]Override the undo library to stop it from inserting the entity info.[/QUOTE] How do I do that? New territory for me...
[QUOTE=Fantym420;46994761]Please don't round off, the map limits are -16384 to 16384 for a total space of 32768, the values in the screen shot are out of range. The Z value is out of range on all those values.[/QUOTE] It is "out-of-range" when using the map editor "Hammer", but when in-game it isn't out-of-range because, as stated, I've had props / vehicles fall through and report positions in the -xxx,000 range.
[QUOTE=Neat-Nit;47014488]How do I do that? New territory for me...[/QUOTE] [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/undo.lua[/url] There's the source code. Copy anything you want to override into your own file and boom, it's overridden. Modify it as you wish. Just note that this is a module file, so anything that isn't local basically has "undo." appended to the front. e.g. undo.Create: [lua] function Create( text ) Current_Undo = {} Current_Undo.Name = text Current_Undo.Entities = {} Current_Undo.Owner = nil Current_Undo.Functions = {} end [/lua] In [B]THAT[/B] file is the same as [lua] function undo.Create( text ) Current_Undo = {} Current_Undo.Name = text Current_Undo.Entities = {} Current_Undo.Owner = nil Current_Undo.Functions = {} end [/lua] in [B]ANY OTHER[/B] file. [editline]26th January 2015[/editline] [QUOTE=!cake;47012053](linex, liney) is a [url=https://en.wikipedia.org/wiki/Parametric_equation]parametric equation[/url] in t, just like your ellipse (touchx, touchy) is defined by a parametric equation in ang. [thumb]https://dl.dropboxusercontent.com/u/7290193/Screenshots/Facepunch/ellipsetangent.png[/thumb][/QUOTE] Thanks, the picture helps. I really didn't expect anyone to be able to answer this.
[QUOTE=bobbleheadbob;47015141][url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/undo.lua[/url] There's the source code. Copy anything you want to override into your own file and boom, it's overridden. Modify it as you wish. Just note that this is a module file, so anything that isn't local basically has "undo." appended to the front. e.g. undo.Create: [lua] function Create( text ) Current_Undo = {} Current_Undo.Name = text Current_Undo.Entities = {} Current_Undo.Owner = nil Current_Undo.Functions = {} end [/lua] In [B]THAT[/B] file is the same as [lua] function undo.Create( text ) Current_Undo = {} Current_Undo.Name = text Current_Undo.Entities = {} Current_Undo.Owner = nil Current_Undo.Functions = {} end [/lua] in [B]ANY OTHER[/B] file.[/QUOTE] Thanks a ton! Just to be clear (although I think I already know the answer), overriding it this way will not mess up its use of local variables? That is, undo.lua uses the local table Current_Undo a lot. Will a function undo.Create that I define in a different file entirely, have access to this table?
[QUOTE=Neat-Nit;47016045]Thanks a ton! Just to be clear (although I think I already know the answer), overriding it this way will not mess up its use of local variables? That is, undo.lua uses the local table Current_Undo a lot. Will a function undo.Create that I define in a different file entirely, have access to this table?[/QUOTE] It will totally break that. You could completely copy the file and completely overwrite everything, OR You could hijack the function's name like this: [lua] local undocreate = undo.Create function undo.Create(name) --do your stuff. Don't modify the name variable directly. --call the old function: undocreate(name) end [/lua]
Does anyone know why bullet holes might not appear in custom entities? Whenever I shoot at it no decals appear. Also does anyone know how to prevent teammates from bleeding when you shoot them? They aren't damaged but the blood effects still show up.
[QUOTE=Sparky-Z;47017321]Does anyone know why bullet holes might not appear in custom entities? Whenever I shoot at it no decals appear. Also does anyone know how to prevent teammates from bleeding when you shoot them? They aren't damaged but the blood effects still show up.[/QUOTE] Does the entity have a proper physobject?
Can anyone link me to any documentation on how to properly send an animation to a player? I tried looking through the base gamemode and I couldn't find how the act command works this is what I tried [code] function TestAnimation(ply,cmd,args) ply:AnimRestartGesture(GESTURE_SLOT_CUSTOM, ACT_GMOD_DEATH, true) ply:AnimSetGestureWeight(GESTURE_SLOT_CUSTOM, 1) print("GESTURING") end concommand.Add( "sendanimation", TestAnimation) [/code] but it gives me an error that ACT_GMOD_DEATH is nil, and does nothing if I give it a non-custom act
[QUOTE=Sparky-Z;47017321]Also does anyone know how to prevent teammates from bleeding when you shoot them? They aren't damaged but the blood effects still show up.[/QUOTE] I think you need to return false to this hook clientside: [url]http://wiki.garrysmod.com/page/GM/PlayerShouldTakeDamage[/url] Garry intentionally always returns true to it in clientside, so the blood effects always appear. You can actually see it in his code. I just don't remember if I saw it in base or in gamemode. I have a question: where is the best place to get the notepad++ syntax highlighting plugin? I think the one I found isn't so great...
[QUOTE=Sparky-Z;47017321]Does anyone know why bullet holes might not appear in custom entities? Whenever I shoot at it no decals appear. [/QUOTE] I've come across the same problem earlier , I think it's not on our hand , Any other decal runs perfect with my code.
I was wondering how I would implement the Sandbox Menu into a new gamemode I am making, would I have to modify the sandbox gamemode or is there a way you can "code" it into a new blank gamemode?
DeriveGamemode( "sandbox" ) in your shared file, "base" "sandbox" in your gamemode.txt
[QUOTE=NiandraLades;47007204]Okay, this might be a tad weird to explain. I've got an entity which is essentially just an ordinary brush with a number attach to it. I need to increase that number each time the entity is made, which I've simple enough. I have made a small map with this entity drawn 16 times. To help see what number each tile has been given, I am using math.fmod to colour them. Even numbers are red, while odd is blue -snip- So, it's like this: 0, 1, 2, 3 4, 5, 6, 7 When I need it to be: 0, 1, 2, 3 7, 6, 5, 4 so it looks like this instead: -snip- I am aware I can reset ent.Number back to 0 every four loops, however that's not what I want. What method should I go back this? My original intention was to do with this lua, however I am thinking maybe it'd be better to do Value = Number in Hammer instead and manually assign each one.[/QUOTE] not sure i fully understand the problem, will this be a map where hammer is going to be recreating the blocks and you need to reassign their numbers or...? im basically confused at what stage the block creation is being handled, and when/how often you are expecting to need to update the numbers. if you are looping through and using an iterator to set the value, cant you just change the order the blocks are being created? if you cant and you can afford to be less dynamic, you could do something like [code] order = {0,1,2,3,4,7,6,5,4}; for k,v in pairs(*get ents here*) do v.Number = order[k]; end [/code] [QUOTE=Cushie;46972625]other section doesnt have a similar thread and i didnt want to make one: i have only ever run servers dealing with a single gamemode, but i put one up recently for friends and they want a shit ton of random addons on just to mess around with in sandbox. problem is we want to play different modes like TTT as well without addons messing it up. i would have been able to just change the workshop command line to a different collection for different modes, but because of the size limit on workshop i had to manually extract and install some addons. is there another way that this can be managed without manually renaming lua/addons folders between changes? [/QUOTE] reposting this
[img]http://i.imgur.com/6aaV1l6.png[/img] How are the map images made exactly, it is being done from a command I can't find in Gmod or via some render option in Hammer? Trying to get one of gm_fork
[QUOTE=The Commander;47019393] How are the map images made exactly, it is being done from a command I can't find in Gmod or via some render option in Hammer? Trying to get one of gm_fork[/QUOTE] [url]https://developer.valvesoftware.com/wiki/Creating_a_working_mini-map[/url] just a bunch of commands
[CODE]lua_run Player(2):SetSubMaterial(0, "models/fuck/test") > Player(2):SetSubMaterial(0, "models/fuck/test")... [ERROR] lua_run:1: attempt to call method 'SetSubMaterial' (a nil value) 1. unknown - lua_run:1 [/CODE] [CODE]lua_run PrintTable(Player(2):GetNWVarTable()) > PrintTable(Player(2):GetNWVarTable())... [ERROR] lua_run:1: attempt to call method 'GetNWVarTable' (a nil value) 1. unknown - lua_run:1[/CODE] Were these deprecated while I wasn't looking? Am I fucking up somewhere?
Those functions only exist on the dev branch (opt-in through Steam > Garry's Mod > Properties > Betas > Select dev in dropdown). It'll be pushed to the public branch in a few weeks.
[QUOTE=Bo98;47020043]Those functions only exist on the dev branch (opt-in through Steam > Garry's Mod > Properties > Betas > Select dev in dropdown). It'll be pushed to the public branch in a few weeks.[/QUOTE] Fuck, that was my last suspicion. Wish this kinda thing was labeled in the Wiki. :v:
[QUOTE=buu342;47006852]For some reason, no matter whether or not the player is near an entity called sent_dwater, it is always setting the NWInt to 1... [lua] ply:ChatPrint(ply:GetNWInt("SaltWater")) for k, ply in pairs( player.GetAll() ) do for k,v in pairs (ents.FindInSphere(ply:GetPos(), 2000)) do if ( v:GetClass() == "sent_dwater" ) then ply:SetNWInt( "SaltWater", 0 ) else ply:SetNWInt( "SaltWater", 1 ) end end end [/lua][/QUOTE] Anyone got anything for this?
[QUOTE=buu342;47020127]Anyone got anything for this?[/QUOTE] [lua] ply:ChatPrint(ply:GetNWInt("SaltWater")) for k, ply in pairs( player.GetAll() ) do ply.saltwaterfound = 1 for k,v in pairs (ents.FindInSphere(ply:GetPos(), 2000)) do if ( v:GetClass() == "sent_dwater" ) then ply.saltwaterfound = 0 end end ply:SetNWInt("SaltWater", ply.saltwaterfound) end [/lua] I hope you realise this is very unoptimised code, however it'll work.
[QUOTE=bobbleheadbob;47018012]Does the entity have a proper physobject?[/QUOTE] I believe so, Entity.GetPhysicsObject returns a valid physics object. [QUOTE=sm69baller;47018326]I've come across the same problem earlier , I think it's not on our hand , Any other decal runs perfect with my code.[/QUOTE] Ah, well if that's the case then that's too bad. :/ [QUOTE=Neat-Nit;47018299]I think you need to return false to this hook clientside: [url]http://wiki.garrysmod.com/page/GM/PlayerShouldTakeDamage[/url] Garry intentionally always returns true to it in clientside, so the blood effects always appear. You can actually see it in his code. I just don't remember if I saw it in base or in gamemode. [/QUOTE] Hmm, for some reason that hook does not run clientside for me, only serverside.
It's a shared hook, you can also use it in clientside
[QUOTE=geferon;47020880]It's a shared hook, you can also use it in clientside[/QUOTE] I know it says shared on the wiki, but I've tried just printing something out in the hook on the client and it didn't work.
Sorry, you need to Log In to post a reply to this thread.