Vous êtes sur la page 1sur 2

SWEP.Author = "Cealeous" SWEP.Contact = "craycarr@yahoo.com" SWEP.Purpose = "Blow up people, duh!" SWEP.

Instructions = "Primary to fire a bullet, Secondary to make an explosion wh ere you are pointing" SWEP.Category = "Explosion SWeps" SWEP.Spawnable = false; SWEP.AdminSpawnable = true; SWEP.ViewModel = "models/weapons/v_357.mdl"; SWEP.WorldModel = "models/weapons/w_357.mdl"; SWEP.Primary.ClipSize = 8; SWEP.Primary.DefaultClip = 20; SWEP.Primary.Automatic = false; SWEP.Primary.Ammo = "357"; SWEP.Secondary.ClipSize = -1; SWEP.Secondary.DefaultClip = -1; SWEP.Secondary.Automatic = false; SWEP.Secondary.Ammo = "none"; SWEP.Sound = Sound ("weapon_357.Single") SWEP.Damage = 100 SWEP.Spread = 0.02 SWEP.NumBul = 1 SWEP.Delay = 0.6 SWEP.Force = 3 function SWEP:Deploy() return true end function SWEP:Holster() return true end function SWEP:Think() end //I made a single line comment! /* I made a multi line comment! OMG, another line! And another! */ function SWEP:SecondaryAttack() // when secondary attack happens // Make sure we can shoot first if ( !self:CanPrimaryAttack() ) then return end local eyetrace = self.Owner:GetEyeTrace(); // this gets where you are looking. The SWep is making an explosion wher e you are LOOKING, right? self.Weapon:EmitSound ( self.Sound ) // this makes the sound, which I specified earlier in the code self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )

//this makes the shooting animation for the 357 local explode = ents.Create( "env_explosion" ) //creates the explosion explode:SetPos( eyetrace.HitPos ) //this creates the explosion where you were looking explode:SetOwner( self.Owner ) // this sets you as the person who made t he explosion explode:Spawn() //this actually spawns the explosion explode:SetKeyValue( "iMagnitude", "220" ) //the magnitude explode:Fire( "Explode", 0, 0 ) explode:EmitSound( "game_win", 400, 400 ) //the sound for the explosion, and how far away it can be heard self.Weapon:SetNextPrimaryFire( CurTime() + self.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Delay ) //this sets the delay for the next primary and secondary fires. self:TakePrimaryAmmo(1) //removes 1 ammo from our clip end //telling Gmod that it's the end of the function function SWEP:PrimaryAttack() //when +attack1 happens // Make sure we can shoot first if ( !self:CanPrimaryAttack() ) then return end local bullet = {} //creates a table for the properties of the bullet bullet.Num = self.NumBul //number of bullets you are shooti ng bullet.Src are standing bullet.Dir et, where you are looking bullet.Spread = let, how accurate it is bullet.Tracer = bullet.Force = bullet.Damage = bullet.AmmoType = = self.Owner:GetShootPos() // Source, where you = self.Owner:GetAimVector() // direction of bull Vector( self.Spread, self.Spread, 0 ) // spread of bul 0 // this doesn't really affect anything self.Force // how powerful it is self.Damage //how much damage it does to people self.Primary.Ammo //what type of ammo you are using

self.Owner:FireBullets( bullet ) //actually shoots the bullet. self.Weapon:EmitSound ( self.Sound ) // this makes the sound, which I specified earlier in the code self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) //this makes the shooting animation for the 357 self.Weapon:SetNextPrimaryFire( CurTime() + self.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Delay ) //this sets the delay for the next primary and secondary fires. self:TakePrimaryAmmo(1) //removes 1 ammo from our clip end //end our function function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ) //animation for reloading end

Vous aimerez peut-être aussi