[CODE]-- Effect settings
SWEP.PrintName = ""
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.ViewModel = "models/weapons/v_.mdl"
SWEP.WorldModel = "models/weapons/w_.mdl"
SWEP.ReloadSound = ""
-- Other settings
SWEP.Base = "weapon_base"
SWEP.Category = ""
SWEP.HoldType = "pistol"
SWEP.Weight = 0
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.FiresUnderwater = false
-- Weapon info
SWEP.Author = "Pvt.Vain"
SWEP.Contact = "No Contacting"
SWEP.Purpose = "Randomness"
SWEP.Instructions = "Randomness"
-- Scope settings
SWEP.UseScope = false
SWEP.ZoomedPrimaryAutomatic = false
SWEP.ZoomedPrimaryDelay = 0
SWEP.ZoomedPrimaryCone = 0
SWEP.ZoomedPrimaryDamage = 0
SWEP.ZoomedPrimaryRecoil = 0
SWEP.ZoomedTracerFreq = 0
SWEP.ZoomedDrawCrosshair = false
-- Primary fire settings
SWEP.Primary.Sound = ""
SWEP.Primary.Damage = 0
SWEP.Primary.NumShots = 0
SWEP.Primary.Recoil = 0
SWEP.Primary.Cone = 0
SWEP.Primary.Delay = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Tracer = 0
SWEP.Primary.Force = 0
SWEP.Primary.TakeAmmoPerBullet = true
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "pistol"
SWEP.Primary.Ignite = false
-- Secondary fire settings
SWEP.Secondary.Sound = ""
SWEP.Secondary.Damage = 0
SWEP.Secondary.NumShots = 0
SWEP.Secondary.Recoil = 0
SWEP.Secondary.Cone = 0
SWEP.Secondary.Delay = 0
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Tracer = 0
SWEP.Secondary.Force = 0
SWEP.Secondary.TakeAmmoPerBullet = false
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector( 0, 0, 0 )
SWEP.IronSightsAng = Vector( 0, 0, 0 )
SWEP.Object = ""
SWEP.ObjectExplode = false
SWEP.ObjectForce = 0
function SWEP:Initialize()
end
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:EmitSound(Sound(self.Primary.Sound))
self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 ))
if ( SERVER ) then
object = ents.Create("prop_physics")
object:SetKeyValue("physdamagescale","500")
if (self.ObjectExplode) then
object:SetKeyValue("explodedamage","25")
object:SetKeyValue("health","500")
object:SetKeyValue("exploderadius","150")
object:SetKeyValue("physdamagescale","1500")
--object:SetColor(255,255,255,255)
end
object:SetModel(self.Object)
object:SetOwner(self.Owner)
object:SetPos(self.Owner:GetShootPos())
object:SetAngles(self.Owner:GetAimVector())
object:Spawn()
local physobj = object:GetPhysicsObject()
local force = self.ObjectForce * physobj:GetMass()
physobj:SetVelocity(self.Owner:GetAimVector() * force)
undo.Create("Launched prop")
undo.AddEntity(object)
undo.SetPlayer(self.Owner)
undo.Finish()
end
self:TakePrimaryAmmo(1)
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
end
function SWEP:SecondaryAttack()
if ( !self:CanSecondaryAttack() ) then return end
self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )
self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self.Weapon:EmitSound(Sound(self.Secondary.Sound))
self.Owner:ViewPunch(Angle( -self.Secondary.Recoil, 0, 0 ))
if ( SERVER ) then
object = ents.Create("prop_physics")
object:SetKeyValue("physdamagescale","500")
if (self.ObjectExplode) then
object:SetKeyValue("explodedamage","25")
object:SetKeyValue("health","500")
object:SetKeyValue("exploderadius","150")
object:SetKeyValue("physdamagescale","1500")
--object:SetColor(255,255,255,255)
end
object:SetModel(self.Object)
object:SetOwner(self.Owner)
object:SetPos(self.Owner:GetShootPos())
object:SetAngles(self.Owner:GetAimVector())
object:Spawn()
local physobj = object:GetPhysicsObject()
local force = self.ObjectForce * physobj:GetMass()
physobj:SetVelocity(self.Owner:GetAimVector() * force)
undo.Create("Launched prop")
undo.AddEntity(object)
undo.SetPlayer(self.Owner)
undo.Finish()
end
self:TakeSecondaryAmmo(1)
self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
end
function SWEP:Think()
end
function SWEP:Reload()
if (self.Weapon:DefaultReload()) then return end
self.Weapon:DefaultReload( ACT_VM_RELOAD )
self.Weapon:EmitSound(Sound(self.ReloadSound))
end
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
return true
end
function SWEP:Holster()
return true
end
function SWEP:OnRemove()
end
function SWEP:OnRestore()
end
function SWEP:Precache()
end
function SWEP:OwnerChanged()
end
function SWEP:ContextScreenClick( aimvec, mousecode, pressed, ply )[/CODE]it keeps getting a error ;P
Can you help?
EDIT: Thats just the base im using. its not a swep its self ;P
It would help greatly if you could post the error and the line which is erroring. No one wants to debug your entire code for you.
oh okay.
one second let me go in to gmod
and check what error
"it keeps getting a error ;P"
What error does it keep getting?
weapons/test/shared.lua:178: 'end' expected near '<eof>'
thats the error ;P
[code]function SWEP:ContextScreenClick( aimvec, mousecode, pressed, ply )[/code]
There's an end expected near <end of function>.
Seriously, these errors aren't that hard to read. You need an end for this function.
okay thank you alot
[editline]08:34PM[/editline]
but also don't have to be a dick. im not good when using lua
You're welcome.
I'm not trying to be a dick. Even if you're not that good at Lua, the errors are made in such a way that you can generally tell what's going wrong.
Protip: Don't make a thread unless you REALLY need help. And infront of the thread option:
Check the friggin WIKI.
Check SEARCH.
Try to FIGURE IT OUT.
We have too many threads where the answer is something simple like, 'You need an end on like 2.'
Now that wasn't really necessary. We all make mistakes sometimes, and I already suggested he do otherwise.
I just wanted to get it out there. There is a thread that says, "READ THIS FIRST" and it doesn't have many views.
Sorry, you need to Log In to post a reply to this thread.