if (SERVER) then
/*---------------------------------------------------------
SWEP wude mit dem DSO Swep Script erstellt
URL: dark-side-one.de.vu
---------------------------------------------------------*/
AddCSLuaFile ("shared.lua");
SWEP.Weight = 5;
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = false;
end
if (CLIENT) then
SWEP.PrintName = "Test Swep"
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.DrawWeaponInfoBox = true
SWEP.BounceWeaponIcon = true
SWEP.SwayScale = 1.0
SWEP.BobScale = 1.0
end
// Variables that are used on both client and server
SWEP.Author = "DSO Team"
SWEP.Contact = "
[email protected]"
SWEP.Purpose = "Meine Absicht"
SWEP.Instructions = "links: Feuer "
SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/weapons/v_rif_aks74u.mdl"
SWEP.WorldModel = "models/weapons/w_rif_aks74u.mdl"
SWEP.AnimPrefix = "python"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = 7
SWEP.Primary.DefaultClip = 30
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "AR2"
SWEP.Secondary.ClipSize = 1
SWEP.Secondary.DefaultClip = 10
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = "AR2"
function SWEP:Initialize()
/*kann man leer lassen*/
end
function SWEP:Precache()
/*kann man leer lassen*/
end
function SWEP:PrimaryAttack()
/* Make sure we can shoot first*/
if ( !self:CanPrimaryAttack() ) then return end
/* Play shoot sound*/
self.Weapon:EmitSound("Weapon_AR2.Single")
/* 50 damage, Shoot 1 bullets, 0.01 aimcone = Streuung der kugeln*/
self:ShootBullet( 50, 1, 0.01 )
/* Remove 1 bullet from our clip*/
self:TakePrimaryAmmo( 1 )
/* Punch the player's view = Die Sicht wird nach oben gehauen*/
self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
/* Zeit bis erneut geschossen wird*/
self:SetNextPrimaryFire( CurTime() + 0.05 )
end
function SWEP:SecondaryAttack()
/*Make sure we can shoot first*/
if ( !self:CanSecondaryAttack() ) then return end
/* Play shoot sound*/
self.Weapon:EmitSound("Weapon_Shotgun.Single")
/* 50 damage, Shoot 3 bullets, 0.03 aimcone*/
self:ShootBullet( 50, 3, 0.03 )
/* Remove 1 bullet from our clip*/
self:TakeSecondaryAmmo( 1 )
/* Punch the player's view*/
self.Owner:ViewPunch( Angle( -3, 0, 0 ) )
/* Zeit bis erneut geschossen wird*/
self:SetNextSecondaryFire( CurTime() + 0.05 )
end
function SWEP:CheckReload()
end
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD );
end
function SWEP:Think()
/*kann man leer lassen*/
end
function SWEP:Holster( wep )
return true
end
function SWEP:Deploy()
return true
end
function SWEP:ShootEffects()
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )
end
function SWEP:ShootBullet( damage, num_bullets, aimcone )
local bullet = {}
bullet.Num = num_bullets
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( aimcone, aimcone, 0 )
bullet.Tracer = 5
bullet.Force = 1
bullet.Damage = damage
bullet.AmmoType = "Pistol"
self.Owner:FireBullets( bullet )
self:ShootEffects()
end
function SWEP:TakePrimaryAmmo( num )
/* Doesn't use clips*/
if ( self.Weapon:Clip1() <= 0 ) then
if ( self:Ammo1() <= 0 ) then return end
self.Owner:RemoveAmmo( num, self.Weapon:GetPrimaryAmmoType() )
return end
self.Weapon:SetClip1( self.Weapon:Clip1() - num )
end
function SWEP:TakeSecondaryAmmo( num )
/* Doesn't use clips*/
if ( self.Weapon:Clip2() <= 0 ) then
if ( self:Ammo2() <= 0 ) then return end
self.Owner:RemoveAmmo( num, self.Weapon:GetSecondaryAmmoType() )
return end
self.Weapon:SetClip2( self.Weapon:Clip2() - num )
end
function SWEP:CanPrimaryAttack()
if ( self.Weapon:Clip1() <= 0 ) then
self:EmitSound( "Weapon_Pistol.Empty" )
self:SetNextPrimaryFire( CurTime() + 0.2 )
self:Reload()
return false
end
return true
end
function SWEP:CanSecondaryAttack()
if ( self.Weapon:Clip2() <= 0 ) then
self.Weapon:EmitSound( "Weapon_Pistol.Empty" )
self.Weapon:SetNextSecondaryFire( CurTime() + 0.2 )
return false
end
return true
end
function SWEP:ContextScreenClick( aimvec, mousecode, pressed, ply )
/*kann man leer lassen*/
end
function SWEP:OnRemove()
/*kann man leer lassen*/
end
function SWEP:OwnerChanged()
/*kann man leer lassen*/
end
function SWEP:Ammo1()
return self.Owner:GetAmmoCount( self.Weapon:GetPrimaryAmmoType() )
end
function SWEP:Ammo2()
return self.Owner:GetAmmoCount( self.Weapon:GetSecondaryAmmoType() )
end
function SWEP:SetDeploySpeed( speed )
self.m_WeaponDeploySpeed = tonumber( speed )
end
/*kann man leer lassen*/
Ist das normal das der Code so aussieht?:(
€: im Editor sieht das aber anders aus...:(