You'd want to do something like:
Code:for k, v in pairs( ents.FindInSphere( hitpos, radius ) ) do info = DamageInfo( ) info:SetDamageType( DMG_BLAST | DMG_DISSOLVE ) info:SetDamage( 15 ) info:SetAttacker( pl ) info:SetInflictor( pl:GetActiveWeapon( ) ) info:SetDamagePos( hitpos ) info:SetDamageForce( ( v:GetPos( ) - hitpos ):GetNormal( ) * force ) v:TakeDamageInfo( info ) end
local explosion = ents.Create("env_explosion") explosion:SetPos(pos) explosion:SetKeyValue("iMagnitude", 100) -- damage explosion:SetKeyValue("iRadiusOverride", 250) -- radius explosion:Spawn() explosion:Fire("explode", "", 0)
That doesn't dissolve stuff.
as for an explosion effect, i'm taking a wild guess that this modifier should work it
local effectsplode = EffectData() effectsplode:SetOrigin(tr.HitPos) effectsplode:SetStart(tr.HitPos()) effectsplode:SetEntity(self) util.Effect("UNKNOWN", effectdata)
"UNKNOWN" is there because i'm not sure of the explosion effects. do they use particle systems?
the only thing i really need right now though is a fix for my holdtype
i'm pretty sure i entered it in right..
SWEP.HoldType = "SMG";
Can't get any derma elements to scroll along with my scrollbar.
I need an LUA script that will make names different colors. I'd like each level of admin etc to have their name in a separate color.
This is for the sandbox game mode.
Whats up with silkicons in the gmod13 update
Any snippet to get ID of player who is firing with specifically weapon?
I'm trying to get an entity to aim at a direction, but instead of it being instant it turn at a set rate
What I have works fine except at a certain angle the entity does a full rotation in the other direction.
What's the proper way to do this?if IsValid(mdl) then mdl:Remove() end mdl=ents.Create("prop_physics") mdl:SetModel("models/props_combine/headcrabcannister01a.mdl") mdl:SetAngles(Angle(0,180,0)) timer.Create("wdf",0.0000001,0,function() local owner=player.GetByID(1) if !IsValid(mdl) then return end if !IsValid(owner) then return end local ang=mdl:GetAngles() local targetangle=owner:EyeAngles() local speed=250*FrameTime() ang.y=math.Approach(ang.y,targetangle.y,speed) ang.p=math.Approach(ang.p,targetangle.p,speed) ang.r=0 mdl:SetAngles(ang) end)
I'm not sure if this is the best place to ask this, but I'll give it a go anyway.
I have a hook on the context menu mouse click, and I'm trying to get the point in the world where the mouse is being clicked as a map coordinate on the server. Does anyone know if this is possible and how I might go about doing it?
Wouldn't that only work client side? I need the server to know where that position would be so I can create an entity.
objPl:GetEyeTrace( ).HitPos ?
well that would only work if you make the player's eyes follow the mouse, never mind
I had tried that but yea, the server only gets the position from the centre of the screen, rather than the mouse.
The server doesn't know the mouse position so you might as well do what I posted and then send the result to the server.
Alrighty, well, I guess I should ask this too.
What would be the best way to send data to the server from a client?
Isn't that being removed in the Garry's Mod 13 update? I'd rather use code that will be usable when that update goes live, unless concommand stuff is changing too?
He isn't sending a table. You should never send a table.
Hey dudes, I'm trying to make a SWEP flashlight but I'm hung up on trying to figure out how to actually draw the light. Is it possible to draw a clientside light who's position is an attachment on a viewmodel? I'm pretty sure it's possible, but I can't find the right hooks to use. The method I've tried is:
local dynamicLight = DynamicLight if (dynamicLight) then dynamicLight.Brightness = 3; dynamicLight.DieTime = CurTime() + 0.1; dynamicLight.Decay = 384; dynamicLight.Size = 384; dynamicLight.Pos = self.Owner:GetAimVector(); -- replace me w/ model attachment stuff dynamicLight.r = 255; dynamicLight.g = 255; dynamicLight.b = 255;
In shared.lua under SWEP:Think(). But of course this didn't work and I suck. Any ideas?
The DynamicLight function is clientside only and afaik some swep functions don't get called clientside on singleplayer.