• How to make normal stasis swep?
    1 replies, posted
I use this code function SWEP:PrimaryAttack()     if SERVER then         local firedtime = 0         local targ,tab = self:SelectTargets(5,dist)                  for k,v in pairs(targ) do                      if tab[v].dot < 0.8 then continue end                              local p = Player()                 local w = SWEP()                              p:SetMaxSpeed(5)             p:SetJumpPower(0)             w:SetDeploySpeed(5)             end end end But I don't know what next, how to make timer of slow, how to make code for shot fx with projectile, which fly to target at some time, and "explosion type" - target all players and props in "damage radius". This for dark rp and some jobs have individual speed. Please, help me.
I suggest you look up some information on weapon effects and animations. Generally what you're looking for is done by writing scripted effects (see Effect Hooks) and then spawning these with util.Effect from with the Primary/SecondaryAttack methods. You can see how this is done by looking at script files of some of the weapons included in the game, or from weapon addons. As for looking within a radius, you can use ents.FindInSphere, setting the origin to the hitpos of a trace and filter out the players with Entity:IsPlayer. A trace can be done from within Primary/SecondaryAttack as follows: local trace = {} trace.start = self.Owner:GetShootPos() trace.endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 10^14 trace.filter = {self.Owner, self} local tr = util.TraceLine(trace) Your origin for ents.FindInSphere is now tr.HitPos, assuming the trace hits an entity.
Sorry, you need to Log In to post a reply to this thread.