Pointshop problem.

ITEM.Name = “Pootz’s Annihilator”
ITEM.Price = 30
ITEM.Model = “models/weapons/v_shot_pm1014.mdl”
ITEM.WeaponClass = “weapon_ttt_punkbuster”
ITEM.SingleUse = false
ply:SteamId(STEAM_0:1:0000000)

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

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

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

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

That’s my code, I get an error. This is the error.

addons/pointshop-master/lua/items/customdonatorweapons/pootz.lua:6: attempt to index global ‘ply’ (a nil value)

  1. unknown - addons/pointshop-master/lua/items/customdonatorweapons/pootz.lua:6
  2. include - [C]:-1
    3. LoadItems - addons/pointshop-master/lua/sh_pointshop.lua:105
    4. unknown - addons/pointshop-master/lua/autorun/pointshop.lua:35

What’s this for?
[lua]ply:SteamId(STEAM_0:1:0000000)[/lua]
It’s not needed, and is cause your errors.

I want it so only ONE person can buy it.

The way that you’re doing it right now, you’re just writing ply:SteamId(STEAM_0:1:0000000) into a single line with nothing else. That’s not going to make the item an exclusive for that person :v:

ply:SteamID() is a function call that takes no arguments and returns the player’s SteamID in STEAM_X:X:X form as a string.

Try this:

[lua]
ITEM.Name = “Pootz’s Annihilator”
ITEM.Price = 30
ITEM.Model = “models/weapons/v_shot_pm1014.mdl”
ITEM.WeaponClass = “weapon_ttt_punkbuster”
ITEM.SingleUse = false

function ITEM:OnBuy(ply)
if ply:SteamID() == “STEAM_0:1:0000000” then
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
end
[/lua]

Edit: Does pointshop call the OnBuy function after points have been removed? In that case I have no idea then

Edit: Scroll down 2 posts

uhh, you can buy it and equip it… but everyone can(i think), I got my friend(the steam id person i put in) and me to both buy it and we can both equip it.

Edit: everyone can buy it

[lua]
function ITEM:CanPlayerBuy(ply)
return ply:SteamID() == “STEAM_0:1:0000000”
end
[/lua]