Coding Help - Pointshop Random Guns

Hello Community,

i already got some basic guns worked on the Pointshop, like the Five-Seven, M4 and so on.

But i want weapons like from the workshop, for example the Titan Fall guns…

I uses this Code, which wont work !

ITEM.Name = ‘Carabine R-101C’
ITEM.Price = 5000
ITEM.Model = ‘models/weapons/w_irifle.mdl’
ITEM.WeaponClass = ‘weapon_ar2’
ITEM.SingleUse = false

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

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

function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
ply:GiveAmmo( 100, “AR2” )
end

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

local function PlayerLoadout( ply )
ply:Give(self.WeaponClass)
end

So please help !

Do you have the gun file and extensions in your server’s addons folder/in your resource.lua code?

Yes i got all that stuff

And I forget to say that i only will get the M4 when i buy this gun with an HL2 Ar2 Picture !

Can you post your M4 file?

Actually its an M16

ITEM.Name = ‘M16 Carabine’
ITEM.Price = 5000
ITEM.Model = ‘models/weapons/w_rif_m4a1.mdl’
ITEM.WeaponClass = ‘weapon_ar2’
ITEM.SingleUse = false

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

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

function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
ply:GiveAmmo( 100, “Pistol” )
end

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

local function PlayerLoadout( ply )
ply:Give(self.WeaponClass)
end

Why is that the weapon class? The weapon class is what defines what weapon are you going to get, you can’t have two identical weapon classes on different weapons.
If it’s the M16 the weapon class should be weapon_ttt_m16

But it works well
you can try it !

I dunno why i choose weapons_ar2 ._.

But where i can find the weapon class in the Titan Fall Weapons File ?

Weapon class = The name of the lua file of the weapon.
So for example the rifle is weapon_zm_rifle
Just look for it in the folder

So the lua file named this : titanfall_r101
Is that the Weapon class ?

I don’t know exactly where you located it but it seems to be it.
Try it?

So ill try it out,
wait a bit
but if this work im gonna love you ! ( no homo bro )
and thanks for explaining to me what the weapon class is, my friend told only shit to me ._.

btw you don’t HAVE to make ITEM.WeaponClass the exact same name as the lua file, but it’s very recommended

Now i will only get Ammonition and not the gun,
the picture ist still the AR2…
I try to uploud the file again, cause i changed something in it

[editline]8th August 2014[/editline]

The uploud will take time…
sorry

Still dont work !

@JasonMan34

Do youve got any idea left ?