1.Я создал папку _BetaScript в ...\common\GarrysMod\garrysmod\addonsf\ 2.Создал Addon.txt\lua\sound 3.Засунул в Sound звук,настроил txt,создал папку wp_shared_plasmablastgun в lua\weapons\ 4.Создал в ней shared.lua 5.Написал код: (и оружие не отображается) 6.Так же использовал куски от Doom 3 SWEPS 5.Код:
function SWEP:Reload() if ( self:GetNextPrimaryFire() > CurTime() ) then return end if ( self.Weapon:Clip1() < self.Primary.ClipSize && self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then self:SetNextPrimaryFire( CurTime() + 3) self:DefaultReload(ACT_VM_RELOAD) self.Owner:SetAnimation( PLAYER_RELOAD ) end end
function SWEP:OnRemove() if SERVER then if self.LoopSound then self.LoopSound:Stop() end end self.InAttack = nil self.attackDelay = nil self.PSound = nil self:SetNWBool("Attack", false) local owner = self.Owner if CLIENT then if IsValid(self) and IsValid(owner) and owner and owner:IsPlayer() then local vm = owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end end end
function SWEP:PrimarySoundStart() if !self.PSound then if SERVER then self.LoopSound = CreateSound(self.Owner, self.Primary.Sound) self.LoopSound:Play() end end self.PSound = true end
function SWEP:PrimaryAttack() if !self:CanPrimaryAttack() then return end
if !self.InAttack then self:SendWeaponAnim(ACT_VM_PULLPIN) self.attackDelay = CurTime() + .4 end self.InAttack = true
if self.attackDelay then if CurTime() < self.attackDelay then return end self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) //self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) self.Owner:ViewPunch( Angle( math.Rand(-.2,-.2) * self.Primary.Recoil, math.Rand(.1,-.1) *self.Primary.Recoil, 0 ) ) self:WeaponSound(Sound("sound/wps/pulse_carbine_firing.wav"))
if ((game.SinglePlayer() && SERVER) || CLIENT) then self:SetNetworkedFloat("LastShootTime", CurTime()) end function SWEP:SecondaryAttack() if !self:CanSecondaryAttack() then return end
if !self.InAttack then self:SendWeaponAnim(ACT_VM_PULLPIN) self.attackDelay = CurTime() + 2 end self.InAttack = true
if self.attackDelay then if CurTime() < self.attackDelay then return end self:SetNextPrimaryFire(CurTime() + self.Primary.Delay) //self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) self.Owner:ViewPunch( Angle( math.Rand(-.2,-.2) * self.Primary.Recoil, math.Rand(.1,-.1) *self.Primary.Recoil, 0 ) ) self:WeaponSound(Sound("sound/wps/pulse_carbine_firing.wav"))
if ((game.SinglePlayer() && SERVER) || CLIENT) then self:SetNetworkedFloat("LastShootTime", CurTime()) end function SWEP:SpecialThink() if ( self:Clip1() <= 10 ) then if self.Owner.LowAmmo == nil then self.Owner.LowAmmo = CurTime() self:EmitSound("weapons/doom3/machinegun/lowammo3.wav") end else self.Owner.LowAmmo = nil end
if self.Owner:KeyReleased(IN_ATTACK) or self:Clip1() <= 0 then if self.InAttack then self:SendWeaponAnim(ACT_VM_RELEASE) //self:SpinDown() end self:OnRemove() end end end end
function SWEP:Holster() return true end function SWEP:Think() end function SWEP:Deploy() self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SendWeaponAnim(ACT_VM_DRAW) return true end
я не знаю где сделал ошибку,я пока в луа не сильно умный