Discord
Steam
/
Garry's Mod
/
Developers
/
What's wrong w..
Login/Join
Event Log
What's wrong with my SWEP?
0 replies, posted
Search
In This Thread
It emits the particles and plays the sounds twice, but it doesn't heal people twice. This only occurs when there are other people on the server, as I recall. [code] if (SERVER) then AddCSLuaFile ("shared.lua") SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false end if (CLIENT) then SWEP.PrintName = "Cleric" SWEP.Slot = 2 SWEP.SlotPos = 1 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false end SWEP.Author = "Braxus"; SWEP.Contact = "braxus@hotmail.com" SWEP.Purpose = "Heal yourself or others." SWEP.Instructions = "Reload to change spells. Left mouse to cast spells.\n\nRay of rejuvenation - Heals the target for a low ammount.\n\nLesser Heal - Heals yourself for 5-20.\n\nHeal - Heals yourself for 15-25.\n\nGreater Heal - Heals yourself for 1-175." SWEP.Category = "Braxus - Magic" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_stunbaton.mdl" SWEP.WorldModel = "models/weapons/w_stunbaton.mdl" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:Initialize() if ( SERVER ) then self:SetWeaponHoldType( "melee" ) end self.delaybeforeswitch = 0 self.spell = 1 self.lesserhealdelay = 0 self.healdelay = 0 self.greaterhealdelay = 0 self.rejraydelay = 0 end function SWEP:Reload() if self.spell == 1 and CurTime() > self.delaybeforeswitch then self.delaybeforeswitch = CurTime() + 0.5 self.owner:PrintMessage( HUD_PRINTCENTER, "Lesser Heal" ) self.spell = 2 elseif self.spell == 2 and CurTime() > self.delaybeforeswitch then self.delaybeforeswitch = CurTime() + 0.5 self.owner:PrintMessage( HUD_PRINTCENTER, "Heal" ) self.spell = 3 elseif self.spell == 3 and CurTime() > self.delaybeforeswitch then self.delaybeforeswitch = CurTime() + 0.5 self.owner:PrintMessage( HUD_PRINTCENTER, "Greater Heal" ) self.spell = 4 elseif self.spell == 4 and CurTime() > self.delaybeforeswitch then self.delaybeforeswitch = CurTime() + 0.5 self.owner:PrintMessage( HUD_PRINTCENTER, "Ray of Rejuvenation" ) self.spell = 1 end end function SWEP:PrimaryAttack() if self.spell == 1 and CurTime() > self.rejraydelay then -- Ray of Rejuvenation self.rejraydelay = CurTime() + 5 timer.Simple( 0.2, function() self.Owner:EmitSound("words/du.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.4, function() self.Owner:EmitSound("words/et.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.6, function() self.Owner:EmitSound("words/cha.wav", math.random(75, 100), 100 ) end ) timer.Simple(1, function() local eyes = self.Owner:GetEyeTrace() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation ( PLAYER_ATTACK1 ) bullet = {} bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( 0, 0, 0 ) bullet.Num = 1 bullet.Damage = 0 bullet.Force = 1 bullet.Tracer = 1 bullet.TracerName = "rejuvenation_ray" bullet.Callback = function ( attacker, tr, dmginfo ) if tr.Entity:IsPlayer() then tr.Entity:SetHealth( tr.Entity:Health() + math.random(1, 30) ) elseif tr.Entity:IsNPC() and tr.Entity:GetClass()=="npc_zombie" or tr.Entity:GetClass()=="npc_headcrab" or tr.Entity:GetClass()=="npc_fastzombie" or tr.Entity:GetClass()=="npc_fastzombie_torso" or tr.Entity:GetClass()=="npc_zombie_torso" or tr.Entity:GetClass()=="npc_headcrab_fast" or tr.Entity:GetClass()=="npc_headcrab_black" or tr.Entity:GetClass()=="npc_zombine" then tr.Entity:SetHealth( tr.Entity:Health() - math.random(10, 100) ) end end self.Owner:FireBullets( bullet ) end ) elseif self.spell == 2 and CurTime() > self.lesserhealdelay then -- Lesser Heal self.lesserhealdelay = CurTime() + 2 timer.Simple( 0.2, function() self.Owner:EmitSound("words/in.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.4, function() self.Owner:EmitSound("words/zo.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.6, function() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation ( PLAYER_ATTACK1 ) self.Owner:EmitSound("words/ru.wav", math.random(75, 100), 100 ) local plypos = self.Owner:GetPos() local effectdata = EffectData() effectdata:SetStart( plypos ) effectdata:SetMagnitude(1.5) effectdata:SetEntity(self.Owner) util.Effect( "heal", effectdata ) self.Owner:SetHealth( self.Owner:Health() + math.random(5, 20) ) self.Owner:EmitSound("spells/heal.wav", math.random(75, 100), math.random(100, 110) ) end ) elseif self.spell == 3 and CurTime() > self.healdelay then -- Heal self.healdelay = CurTime() + 3.5 timer.Simple( 0.3, function() self.Owner:EmitSound("words/zo.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.55, function() self.Owner:EmitSound("words/in.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.8, function() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation ( PLAYER_ATTACK1 ) self.Owner:EmitSound("words/ru.wav", math.random(75, 100), 100 ) local plypos = self.Owner:GetPos() local effectdata = EffectData() effectdata:SetStart( plypos ) effectdata:SetMagnitude(2) effectdata:SetEntity(self.Owner) util.Effect( "heal", effectdata ) self.Owner:SetHealth( self.Owner:Health() + math.random(15, 25) ) self.Owner:EmitSound("spells/heal.wav", math.random(75, 100), math.random(90, 100) ) end ) elseif self.spell == 4 and CurTime() > self.greaterhealdelay then -- Greater Heal self.greaterhealdelay = CurTime() + 10 timer.Simple( 0.4, function() self.Owner:EmitSound("words/cha.wav", math.random(75, 100), 100 ) end ) timer.Simple( 0.8, function() self.Owner:EmitSound("words/ru.wav", math.random(75, 100), 100) end ) timer.Simple( 1.2, function() self.Owner:EmitSound("words/ka.wav", math.random(75, 100), 100 ) end ) timer.Simple( 1.6, function() self.Owner:EmitSound("words/un.wav", math.random(75, 100), 100 ) end ) timer.Simple( 2, function() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation ( PLAYER_ATTACK1 ) local plypos = self.Owner:GetPos() local effectdata = EffectData() effectdata:SetStart( plypos ) effectdata:SetMagnitude(2.5) effectdata:SetEntity(self.Owner) util.Effect( "heal", effectdata ) self.Owner:SetHealth( self.Owner:Health() + math.random(1, 175) ) self.Owner:EmitSound("spells/heal.wav", math.random(75, 100), math.random(80, 90) ) end ) end end function SWEP:SecondaryAttack() end [/code]
Sorry, you need to
Log In
to post a reply to this thread.