[HELP] Adding Popcorn to my Cinema Server !! :(

Hello guys!
I Want to add popcorn on my cinema server !
I have tried this lua script but it’s not working ! and i don’t know why
i got this problem everytime when i type on the console: lua_openscript popcorn.lua

[ERROR] lua/popcorn.lua:4: attempt to index global ‘SWEP’ (a nil value)

  1. unknown - lua/popcorn.lua:4

Can anyone help me fixing this problem?? please guys !

I want when players type: /popcorn, then they will automatically get this Popcorn !

Thanks a lot guys!

[lua]-- Effect settings
SWEP.PrintName = “Popcorn” –
SWEP.Slot = 1 –
SWEP.SlotPos = 1 –
SWEP.DrawAmmo = false –
SWEP.DrawCrosshair = false –
SWEP.ViewModel = “models/popcorn.mdl” –
SWEP.WorldModel = “models/popcorn.mdl” –
SWEP.ReloadSound = “clipin.wav” –

– Other settings
SWEP.HoldType = “physgun”
SWEP.Weight = 1 –
SWEP.AutoSwitchTo = true –
SWEP.AutoSwitchFrom = false –
SWEP.Spawnable = true –
SWEP.AdminSpawnable = true –
–SWEP.AutoReload = true –

– Weapon info
SWEP.Author = “Maxsnipez” –
SWEP.Contact = “maxwlang@me.com” –
SWEP.Purpose = “” –
SWEP.Instructions = “” –

– 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 = false –
SWEP.Primary.Automatic = false –
SWEP.Primary.Ammo = “” – –

– 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 = 0 –
SWEP.Secondary.DefaultClip = 0 –
SWEP.Secondary.Tracer = 0 –
SWEP.Secondary.Force = 0 –
SWEP.Secondary.TakeAmmoPerBullet = true –
SWEP.Secondary.Automatic = false –
SWEP.Secondary.Ammo = “” – –

SWEP.Object = “” –
SWEP.ObjectExplode = false –
SWEP.ObjectForce = 2500

function SWEP:Initialize() –
self:SetWeaponHoldType( self.HoldType )
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() – Called when we press secondary fire
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 ) –
end[/lua]

[lua][lua ] and [ /lua][/lua] please

done sorry :frowning: bro

[editline]21st June 2014[/editline]

can you help me to add it on the pointshop?

http://forum.facepunch.com/showthread.php?t=1403384