Popcorn SWEP and pointshop

Hello, can someone please tell me how can i add Popcorn SWEP to pointshop? I tried it myself but all i get is errors. :smiley:

My code:


ITEM.Name = 'Popcorn'
ITEM.Price = 500
ITEM.Model = 'garrysmod\models	eh_maestro\popcorn.mdl'

function ITEM:OnEquip(ply, modifications)
	ply:PS_AddClientsideModel(self.ID)
end


Create the file and put it in: pointshop/lua/items/weapons/



ITEM.Name = 'Popcorn'
ITEM.Price = 500
ITEM.Model = 'models/teh_maestro/popcorn.mdl'
ITEM.WeaponClass = 'weapon_popcorn'   --Just a guess idk the SWEP name
ITEM.SingleUse = true

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end


You don’t need to include garrysmod in the model path, it is the default root directory.
Also use ‘/’ instead of ‘’ when setting file paths.

This is not tested, I don’t have Pointshop or the popcorn swep.

Basically, what you did was take a file that’s meant for hats/accessories instead of weapons

Okay, so the problem is that i can’t see popcorn in my hand and i can spamthrow it, then it gives lua errors.

Errors: http://postimg.org/image/vovn1o5f7/

Not sure, if I had to guess the ITEM.WeaponClass is incorrect. Can somebody please confirm the name for the Popcorn SWEP.

Oh, that’s an issue with the swep itself, not your Pointshop file

I know something was changed with particle emitters when gmod updated about a month or so ago, but I wouldn’t exactly know how to fix it. You could either contact the owner and point it out or wait for someone with more knowledge than me to point you in the right direction

pretty sure i can fix that i just need you to post the code since i dont want to download that.

cl_init.lua:


include("shared.lua")

local function kernel_init(particle, vel)
	particle:SetColor(255,255,255,255)
	particle:SetVelocity( vel or VectorRand():GetNormalized() * 15)
	particle:SetGravity( Vector(0,0,-200) )
	particle:SetLifeTime(0)
	particle:SetDieTime(math.Rand(5,10))
	particle:SetStartSize(2)
	particle:SetEndSize(0)
	particle:SetStartAlpha(255)
	particle:SetEndAlpha(0)
	particle:SetCollide(true)
	particle:SetBounce(0.25)
	particle:SetRoll(math.pi*math.Rand(0,1))
	particle:SetRollDelta(math.pi*math.Rand(-10,10))
end

function ENT:Initialize()
	
	self.emitter = ParticleEmitter(self:GetPos())
	
	if self and self:EntIndex() != 0 then
		local kt = "kernel_timer"..self:EntIndex()
		timer.Create(kt,0.01,0,function()
			if !self.emitter then
				timer.Stop(kt)
				return 
			end
			if math.Rand(0,1) < 0.33 then
				local particle = self.emitter:Add( "particle/popcorn-kernel", self:GetPos() + VectorRand():GetNormalized() * 4 )
				if particle then
					kernel_init(particle)
				end
			end
		end)
		timer.Simple(10, function ()
			timer.Destroy(kt)
			if self and self.emitter then
				self.emitter:Finish()
			end
		end)
	end

	net.Receive("Popcorn_Explosion",function () 

		if !self then return end
		local pos = net.ReadVector()
		local norm = net.ReadVector()
		local bucketvel = net.ReadVector()
		local entid = net.ReadFloat()
		
		timer.Destroy("kernel_timer"..entid)
		local emitter = self.emitter or ParticleEmitter(pos)
		for i = 1,150 do
			local particle = emitter:Add( "particle/popcorn-kernel", pos )
			if particle then
				local dir = VectorRand():GetNormalized()
				kernel_init(particle, ((-norm)+dir):GetNormalized() * math.Rand(0,200) + bucketvel*0.5 )
				
			end
		end
		emitter:Finish()
	end)
end


Would be cool if you had to wait 1minute before you can throw your popcorn again… Is it possible?

you could add a timer if there isnt one

But i don’t know how… :confused:

You could try putting something like this in the SWEP:PrimaryAttack()



 self:SetNextPrimaryFire( CurTime() +60 )


Sorry if this is wrong, I don’t have the script to test.

So because you “don’t know how… :/” that makes it okay for everyone to do everything for you? Why not actually put some effort and educate yourself on how to do this, so then you can do it for yourself in the future? Or is that too much work.

Judging from his post count and lack of knowledge I figured he was at the point where he doesn’t even know where or what to look for. That’s why I gave him a free-bee. I remember those days, I’m paying back my debt to face-punch haha.

Or do stupid things like things like use a timer instead of SetNextPrimaryFire() :stuck_out_tongue:

Please guys it’s still not working, i need help !

When i throw up popcorn i got this:

TEST [lua/entities/sent_popcorn_thrown/cl_init.lua][lua/entities/sent_popcorn_thrown/cl_init.lua]
FOUND IN ADDON [171935748]
TEST [lua/entities/sent_popcorn_thrown/init.lua][lua/entities/sent_popcorn_thrown/cl_init.lua]
TEST [lua/entities/sent_popcorn_thrown/shared.lua][lua/entities/sent_popcorn_thrown/cl_init.lua]

[Popcorn SWEP] lua/entities/sent_popcorn_thrown/cl_init.lua:31: Tried to use invalid object (type CLuaEmitter) (Object was NULL or not of the right type)

  1. Add - [C]:-1
  2. unknown - lua/entities/sent_popcorn_thrown/cl_init.lua:31

Timer Failed! [kernel_timer431][@lua/entities/sent_popcorn_thrown/cl_init.lua (line 25)]

Your popcorn swep is broken, nothing we can do about it. Report this to its author.

The author is not supporting it anymore ! :frowning:

Here is what you need to add in PointShop ! but it’s not working :frowning:

Please guys, i beg you! if you can do anythings about it ! i really need it :’( :’(

[editline]21st June 2014[/editline]

I found this Popcorn Script !! and i think it’s gonna works

Can anyone make it’ compatible with the PointShop?

Here is what i found:

And:

Thanks you guys! if anyone can make it compatible with the pointshop