I cant find the stupid error.

well, when i go into game, I get this error "
weapons/weapon_adminweapon/shared.lua:95: ‘end’ expected (to close ‘function’ at line 53) near ‘<eof>’

"

This is my code, but can’t see what’s wrong wit line 53

[lua]
local ShootSound = Sound(

“weapons/crossbow/fire1.wav” )

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			

= “smg”

end

if ( CLIENT ) then

SWEP.PrintName			

= “The Admin Weapon”
SWEP.Author

= "b4nny:code TacoNinja1995:Edit"
SWEP.Slot				

= 3
SWEP.SlotPos

= 2
SWEP.Contact

= “”
SWEP.Purpose

= “Killing”
SWEP.Instructions =

“Left Click:Shoot balls”

end

function SWEP:LaunchPill( )
if (!SERVER) then return end
local RandAngles = Angle

(math.random(0,360),math.random

(0,360),math.random(0,360))
local ply = self.Owner
local pill = ents.Create

(“models/props_junk/sawblade001a.mdl”)
pill:SetPos

(ply:GetShootPos())
pill:SetAngles(

RandAngles )
pill:Spawn()
pill:Fire(“Kill”, “”, 120)

local bPhys = pill:GetPhysicsObject()
local Force = ply:GetAimVector() * 

10000
bPhys:ApplyForceCenter(Force)
self.Weapon:SetNextPrimaryFire

(CurTime() + self.Primary.Delay)
end
function SWEP:PrimaryAttack( )
self:LaunchPill()
self.Weapon:EmitSound(

ShootSound, 75, 110 )
self.BaseClass.ShootEffects( self )
end

function SWEP:ReportNumPills()
local numpills = #ents.FindByClass

(“models/props_junk/sawblade001a.mdl”)
if numpills < 1 then return end
if numpills > 1 then plPill = " Blades "
else plPill = " pill. "
end
Msg("Removed " … numpills … plPill )
end

function SWEP:DeletePills()
if (!SERVER) then return end
util.PrecacheSound(

“ambient/energy/spark1.wav” )
for k,v in pairs(ents.FindByClass

(“models/props_junk/sawblade001a.mdl”)) do
v:Remove()
v:EmitSound(

“ambient/energy/spark1.wav”, 70, 100 )

end

function SWEP:SecondaryAttack( )
self:DeletePills()
self:ReportNumPills()
end

SWEP.Spawnable =

false
SWEP.AdminSpawnable =

true

SWEP.ViewModel =

“models/weapons/v_smg1.mdl”
SWEP.WorldModel =

“models/weapons/w_smg1.mdl”

SWEP.Weight

= 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom =

false

SWEP.Primary.Recoil = 0
SWEP.Primary.Damage

= 40
SWEP.Primary.NumShots =1
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = -1
SWEP.Primary.Delay =

0.12
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic =

true
SWEP.Primary.Ammo

= “none”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Delay = 1.0
SWEP.Secondary.Ammo

= “none”

–Thanks Fatal Muffin (well, thats what the original code said, but I really thought it was TheGreatVax who made it) for making the Ak47 that

shoots babies.
–I just modded his code a little bit and made

this.
[/lua]

help is appreciated, and that goes without saying.

What are you doing that so poorly formats the code like that

I agree, that’s atrocious code, there. Anyway, here’s your problem: You forgot to end function SWEP:DeletePills().

Make it look like this:
[lua]
function SWEP:DeletePills()
if (!SERVER) then return end
util.PrecacheSound( “ambient/energy/spark1.wav” )
for k,v in pairs( ents.FindByClass(“models/props_junk/sawblade001a.mdl”) ) do
v:Remove()
v:EmitSound( “ambient/energy/spark1.wav”, 70, 100 )
end
end
[/lua]

No wonder you can’t see the error: Your code could not be any worse.

Edit: Taehl has it, I would think

its not my code, just playing around with shooting entities. My code is much neater, but i don’t really feel like cleaning this one up.

[editline]04:51PM[/editline]

Well, now it appears in the weapons list, but when i shoot it, i get this error.

Attempted to create unknown entity type models/props_junk/sawblade001a.mdl!
weapons/weapon_bballshooter/shared.lua:28: Tried to use a NULL entity!
Attempted to create unknown entity type models/props_junk/sawblade001a.mdl!
weapons/weapon_bballshooter/shared.lua:28: Tried to use a NULL entity!

It does that like a BAGILLION times in the console, and nothing comes out of the gun :frowning:

[lua] local pill = ents.Create (“models/props_junk/sawblade001a.mdl”) [/lua]

That wouldnt work. You need to create a prop_physics and then set the model to that model.

no idea how to do that…

I’d suggest taking a look into reading the pil, looking how to properly format your code, look at other peoples code before jumping into some thing and making a balls of it all. We can barely help you with this mere unreadable code.

[lua] local pill = ents.Create(“prop_physics”)
pil:SetModel(“models/props_junk/sawblade001a.mdl”)
pill:SetPos(ply:GetShootPos())
pill:SetAngles( RandAngles )
pill:Spawn()
pill:Fire(“Kill”, “”, 120)[/lua] Replace lines 49-59 with this.

it says in the code! I am playing around with other peoples code, this isnt mine!

[lua]local ShootSound = Sound( “weapons/crossbow/fire1.wav” )

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

end

SWEP.PrintName		= "The Admin Weapon"			
SWEP.Author		= "B4nny/ Jammie / TacoNinja"
SWEP.Slot		= 3
SWEP.SlotPos		= 2
SWEP.Contact		= "N3wb Facepunch Account"
SWEP.Purpose		= "Peow."
SWEP.Instructions		= "Left Click:Shoot balls"

SWEP.Spawnable			= false
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_smg1.mdl"
SWEP.WorldModel			= "models/weapons/w_smg1.mdl"

SWEP.Primary.Recoil			= 0
SWEP.Primary.Damage			= 40
SWEP.Primary.NumShots		=1
SWEP.Primary.Cone			= 0
SWEP.Primary.ClipSize		= -1
SWEP.Primary.Delay			= 0.12
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "none"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Delay 		= 1.0
SWEP.Secondary.Ammo			= "none"

function SWEP:LaunchPill( )
if (!SERVER) then return end
local RandAngles = Angle(math.random(0,360), math.random(0,360), math.random(0,360))
local ply = self.Owner
local pill = ents.Create(“prop_physics”)

    pil:SetModel("models/props_junk/sawblade001a.mdl")
pill:SetPos(ply:GetShootPos())
pill:SetAngles( RandAngles )
pill:Spawn()
pill:Fire("Kill", "", 120)

local bPhys = pill:GetPhysicsObject()
local Force = ply:GetAimVector() * 10000

bPhys:ApplyForceCenter(Force)
self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)

end

function SWEP:PrimaryAttack( )
self:LaunchPill()
self.Weapon:EmitSound( ShootSound, 75, 110 )
self.BaseClass.ShootEffects( self )
end

function SWEP:ReportNumPills()
local numpills = #ents.FindByClass(“PUT YOUR ENTITY NAME HERE”)
if numpills < 1 then return end
if numpills > 1 then plPill = " Blades "
else plPill = " pill. "
end
Msg("Removed " … numpills … plPill )
end

function SWEP:DeletePills()

util.PrecacheSound( "ambient/energy/spark1.wav" )

for k,v in pairs(ents.FindByClass("PUT YOUR ENTITY NAME HERE")) do
	v:Remove()
	v:EmitSound( "ambient/energy/spark1.wav", 70, 100 )

end

function SWEP:SecondaryAttack( )
self:DeletePills()
self:ReportNumPills()
end[/lua]

That wasnt so hard now, was it? Took me 10 minutes to make that look readable. You could have done the same.

Line 67 and Line 79, you need to put your entities name in the places where I specified.

New error, and, I don’t know how to fix it.

weapons/weapon_sawlauncher/shared.lua:88: ‘end’ expected (to close ‘function’ at line 75) near ‘<eof>’

You see how there’s two "end"s there? You need both of them. The first one ends the “for k,v”, and the second one ends “function SWEP:DeletePills()”.

Forgot an end in the for statement at Line 79. :v:

Ninja’d.

new error

weapons/weapon_sawlauncher/shared.lua:47: attempt to index global ‘pil’ (a nil value)

Change the name to “pill”, not “pil”. C’mon man, did you even look at the code this time?

yup, i found a “pil” instead of “pill” changed it, and testing now.

[editline]11:58PM[/editline]

Yay, it works ALMOST perfectly now, but the right click removing doesn’t work.

This is where that evil little bug is, I think.

[lua]
function SWEP:ReportNumPills()
local numpills = #ents.FindByClass(“models/props_junk/sawblade001a.mdl”)
if numpills < 1 then return end
if numpills > 1 then plPill = " Blades "
else plPill = " pill. "
end
Msg("Removed " … numpills … plPill )
end

function SWEP:DeletePills()

util.PrecacheSound( "ambient/energy/spark1.wav" )

for k,v in pairs(ents.FindByClass("models/props_junk/sawblade001a.mdl")) do
	v:Remove()
	v:EmitSound( "ambient/energy/spark1.wav", 70, 100 )

end

end

function SWEP:SecondaryAttack( )
self:DeletePills()
self:ReportNumPills()

end
[/lua]

We’ve already told you that a model is not a class. You need to look for entities with the prop_physics class, then check their model.

alright, I have it removing props_physics, but how would I have it specify sawblades?

and, is there a way to set the force the blades come out at?