• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=PortalGod;47466001]even though you fixed it, the problem was because you used a dot instead of a colon a colon automatically passes the object you're calling the function on as the first argument to the function[/QUOTE] Yeah, I know; I just forgot it. Would self:EmitSound() have worked?
[QUOTE=>_> Ubercake;47464064]ply:GetVehicle() doesn't work[/QUOTE] Okay can someone please test this? Not even ply:InVehicle() works. It returns false when I'm not in a vehicle and does NOTHING when I'm in a vehicle
[QUOTE=>_> Ubercake;47466043]Okay can someone please test this? Not even ply:InVehicle() works. It returns false when I'm not in a vehicle and does NOTHING when I'm in a vehicle[/QUOTE] Maybe the PlayerTick hook isn't running at all when you're in a vehicle? If you try something like this that doesn't do anything except let you know that the hook is being called... [code]hook.Add("PlayerTick","playerticktest",function(ply,mv) MsgN("butts") end)[/code] ...does the console spam stop happening when you get in the vehicle and then resume once you get out?
Is it possible to edit a vehicle script's properties specific to a spawned entity. Changing things like MaxSpeed on a spawned entity without having to create a new script file?
Not yet. You could read the stuff directly from the txt tho.
Does anyone have a snippet of code for doing a trace that ignores translucent materials? I'm trying to make a stun grenade but using normal tracers means the effect is blocked by glass.
[QUOTE=DarthTealc;47466560]Any tips on SetSubMaterial? I want to place a 'decal' on a player's shirt but I'm only able to replace the material completely. Would I have to create a Lua material that combines the existing material and the 'decal' and then apply that as the SubMaterial? Or is SetSubMaterial the wrong way to go about this?[/QUOTE] I actually built a rendertarget system for my blood on guns, so maybe something like that? You will have to figure out how to instance materials though.
Yo everyone, just a quick question that I think has a quick answer. I'm new to GMod and have some experience with modding in CoD4, however the whole "CLIENT" and "SERVER" stuff is new. I modified the stock knife from TTT to only insta-kill when being behind the victim. To achieve this, I check whether the attacker's angle differs from the victim's angle by <50° (both players looking roughly in the same direction, which only is the case when the attacker is behind the victim). This works brilliantly when calculating the damage SERVER-side. [CODE]if hitEnt:Health() < (self.Primary.Damage + 10) or AngularDiff(hitEnt:GetAngles(), self.Owner:GetAngles(), 50) then self:StabKill(tr, spos, sdest) ... function AngularDiff(a, b, range) local diff = math.AngleDifference( a.y, b.y ) if math.abs(diff) <= range then return true end return false end[/CODE] However, the knife also has an "INSTANT KILL" text inside a "IF CLIENT THEN" condition at the end of the file, which is being displayed when the knife's default damage + 10 is higher than the victim's health. I want to add my "from behind"-modification to the condition, but it does not return the victim's valid angles. When trying to get the player's angles you are looking at, you always get 0. [CODE]local tr = self.Owner:GetEyeTrace(MASK_SHOT) local localPlayer = LocalPlayer() if tr.HitNonWorld and IsValid(tr.Entity) and tr.Entity:IsPlayer() and (tr.Entity:Health() < (self.Primary.Damage + 10) or AngularDiff(tr.Entity:GetAngles(), self.Owner:GetAngles(), 50) )then[/CODE] tr.Entity:GetAngles() always returns 0, no matter how the victim is rotated. [B]Is there a quick way to be able to get the victim's angles inside the attacker's CLIENT?[/B]
How do I tell if a player is standing on the ground efficiently? [editline]6th April 2015[/editline] Nevermind, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/IsOnGround]Entity:IsOnGround[/url] is what I was looking for. For some reason it didn't show up in the player class function list on the wiki.
I'm making a SWEP and how do I set it so it has unlimited ammo? Like you can't pick up ammo, or ever run out of ammo, and to hide the ammo in the bottom left corner.
How do I stop a sound started by Entity:EmitSound?
[QUOTE=FuzionUK;47468509]I'm making a SWEP and how do I set it so it has unlimited ammo? Like you can't pick up ammo, or ever run out of ammo, and to hide the ammo in the bottom left corner.[/QUOTE] You'll want to add these lines; [lua] SWEP.DrawAmmo = false SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Ammo = "none" [/lua] [editline]6th April 2015[/editline] [QUOTE=Drakehawke;47468576]How do I stop a sound started by Entity:EmitSound?[/QUOTE] You want to call [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/StopSound]Entity:StopSound[/url] with the path to the sound file that you started.
[video=youtube;YUkG_T_QbaM]http://www.youtube.com/watch?v=HnwlWG5hcnw[/video] I want my effect (beam) to draw all the time. No matter what. Currently it stops rendering whenever one of the points of the beam is not visible. Anyone know what I should be typing in?
Alright so im pretty sure this question has been asked here before. However after 2 hours of googling im still empty handed. The issue is ever since i moved my server to Nitrous Network my Spiderman swep addon doesnt work anymore. it barely lifts you above the ground. If anyone has experienced the same issue and know how i can fix it i would be really gratefull. Cheers.
[QUOTE=VIoxtar;47468733][video=youtube;YUkG_T_QbaM]http://www.youtube.com/watch?v=HnwlWG5hcnw[/video] I want my effect (beam) to draw all the time. No matter what. Currently it stops rendering whenever one of the points of the beam is not visible. Anyone know what I should be typing in?[/QUOTE] You'd probably be better off making a thread about it. You should also put your code if you want it to be solved.
[QUOTE=color0a;47468797]Alright so im pretty sure this question has been asked here before. However after 2 hours of googling im still empty handed. The issue is ever since i moved my server to Nitrous Network my Spiderman swep addon doesnt work anymore. it barely lifts you above the ground. If anyone has experienced the same issue and know how i can fix it i would be really gratefull. Cheers.[/QUOTE] Set your server tickrate to 66 (think hooks run dependent on server tickrate). Nitrous are shit and set you (by default) to 33, or sometimes 16.
Whenever I try and use my SWEP I get this error [code]attempt to call method 'CanPrimaryAttack' (a nil value)[/code]
[QUOTE=Phoenixf129;47468813]Set your server tickrate to 66 (think hooks run dependent on server tickrate). Nitrous are shit and set you (by default) to 33, or sometimes 16.[/QUOTE] Thanks for the quick reply. i tried to add this to my server.cfg [CODE]sv_maxrate 20000 sv_maxupdaterate 66[/CODE] but it didnt work. how should i change the tickrate? just got the server today, so im kinda lost.
[QUOTE=Robotboy655;47467575]Not yet. You could read the stuff directly from the txt tho.[/QUOTE] I ended up making it generate a new vehicle script with the changed values and then changing it for the spawned entity - I'm creating road spikes and this seem to be the most efficient way to do it (?). However it doesn't seem like the spawned vehicle is actually changed. Retrieving the key values from the entity indicates it's changed, but could it be because the vehicle script can't be changed after the vehicle is spawned? In that case I don't know how I should limit its speed.
[QUOTE=VIoxtar;47468733][video=youtube;YUkG_T_QbaM]http://www.youtube.com/watch?v=HnwlWG5hcnw[/video] I want my effect (beam) to draw all the time. No matter what. Currently it stops rendering whenever one of the points of the beam is not visible. Anyone know what I should be typing in?[/QUOTE] [url]http://wiki.garrysmod.com/page/Entity/SetRenderBounds[/url]
[QUOTE=Robotboy655;47468979][URL]http://wiki.garrysmod.com/page/Entity/SetRenderBounds[/URL][/QUOTE] Hey, thanks for that. I tried messing with this before, but I don't know how I should be using it.
[QUOTE=VIoxtar;47469061]Hey, thanks for that. I tried messing with this before, but I don't know how I should be using it.[/QUOTE] Please, stop being so lazy and look into source code of similar things to what you are doing. Look at the source code of the original tool tracer: [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/effects/tooltracer.lua#L20[/url] Seriously now. People need to stop being lazy and depending on other people and learn to get info yourself.
That is what I did and what I already had it set to, came here to see if there were other suggestions. Guess I should have pointed that out earlier. Thanks anyways.
[QUOTE=FuzionUK;47468910]Whenever I try and use my SWEP I get this error [code]attempt to call method 'CanPrimaryAttack' (a nil value)[/code][/QUOTE] That simply means the function CanPrimaryAttack doesn't exist. [editline]6th April 2015[/editline] That's probably a result of some lazy copy and paste job.
Hi. I'm making complex polygons. Here is the output of my debug: [code] X: 320 Lower X Range: 200 Upper X Range: 320 Is 320 > 200: true Is 320 < 320: true [/code] This is the code that produced that output: [lua] print("X:", x) print("Lower X Range:",minx1) print("Upper X Range:",maxx1) print("Is "..x.." > "..minx1..":", x > minx1) print("Is "..x.." < "..maxx1..":", x < maxx1, "\n") [/lua] Clearly, CLEARLY, 320 > 200. Clearly, CLEARLY, 320 IS NOT < 320 Why the FUCK is it saying 320 < 320!? EDIT: Usually it works right! GAH! [code] X: 264.28571428571 Lower X Range: 200 Upper X Range: 320 Is 264.28571428571 > 200: true Is 264.28571428571 < 320: true X: 200 Lower X Range: 200 Upper X Range: 280 Is 200 > 200: false Is 200 < 280: true [/code] I am so frustrated right now. Is this the work of a vires? ([url=https://www.dropbox.com/s/uyy7zm25ydsbmpk/complexpolynew.lua?dl=0]Full code[/url])
Any way to stop [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/SetMaterial]render.SetMaterial[/url] from stretching to fit the surface it's applied to if the surface happens to be done using mesh.Begin?
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url] doesn't work quite as it should. Who can I report the issue to?
Either Gmod or Awesomium parses URLs incorrectly, leading to errors. This is quite a technical problem. [url]http://translate.google.co.uk/transl...tl=fr&q=%C3%A9[/url] is parsed as: [url]http://translate.google.co.uk/transl...l=fr&q=%C3+%A9[/url] AND [url]http://translate.google.co.uk/translate_tts?tl=fr&q=%E9[/url] is parsed as: [url]http://translate.google.co.uk/transl...tl=fr&q=%C3%A9[/url] which is then parsed as: [url]http://translate.google.co.uk/transl...l=fr&q=%C3+%A9[/url] It appends +'s to URL encoded characters incorrectly (the +s are normally used for spaces) [editline]7th April 2015[/editline] For some reason the forum doesn't like me posting these URLs...
[QUOTE=DarthTealc;47473836]Ah I haven't done anything with URLs that require URL encoding in that way. Have you tried opening an HTML panel? I don't think sound.PlayURL uses Awesomium so if they do the same in an HTML panel (which does use Awesomium) and sound.PlayURL then it's likely a Gmod issue.[/QUOTE] To fix it, I had to do this: [CODE] if not IsValid(HTML) then HTML = vgui.Create("HTML") end HTML:OpenURL(voice..text)[/CODE] instead of [CODE]sound.PlayURL ( voice..text, "", function() print "blah" end )[/CODE] Since OpenURL seems to parse the URLs with encoded characters correctly, unlike PlayURL [editline]7th April 2015[/editline] Meaning it's likely a Gmod issue instead of Awesomium
if i got a class of a weapon, how would i get its ammo type?
Sorry, you need to Log In to post a reply to this thread.