Slot-Problem

Hey,

i’m just having a problem with SWEP’s on the same slot.

I’ve added the TTT minigun to the traitor-shop (a primary weapon).

Basically, I just want, that there is just 1 weapon per slot (Minigun --> Slot 3, (Random-Weapon[Famas]) --> Slot 3) and not 2.

Is that possible?

Find the weapon_name.lua file in the (gamemode/terrortown/entities/weapons/) directory. Open it, and look for (SWEP.Slot)
[lua]SWEP.Slot = 1 // Which weapon slot you want your SWEP to be in? (1 2 3 4 5 6)[/lua]
If it’s an addon, then go into your (addons/addon_name/entities/weapons/) and find the file that contains that line there.

Once you’ve successfully found it, simply change the number to what slot you desire.

It’s probably wise to mention that the actual in-game slot is the SWEP.Slot + 1.
i.e. if you set SWEP.Slot = 2, it will be in Slot 3 in game.

Well, Karp you probably didn’t understand what i mean, or i explained it wrong.
Thanks for your help, anyways.

Okay, let me explain.

I open my pointshop, buy the minigun, have 2 weapons on slot <x>.
That’s the problem.
Either the minigun OR the other weapon (Famas, GS3G1 etc.), not both.
Maybe i can hook into something like WeaponEquip, don’t know actually.

Snip

Okay, i’ve created a hook now.



local weapons = 
{
"m9k_val",		
"m9k_winchester73",
"weapon_ttt_sg552",
"weapon_ttt_silm4a1"							
}
hook.Add("PlayerCanPickupWeapon", "Tetsts", function(ply, wep)
   if ply:HasWeapon("weapon_minigun") then return false end
   for k, v in pairs(weapons) do
	if ply:HasWeapon(v) then 
	return false
	end
   end
end)


The important line is:


 for k, v in pairs(weapons) do 

.
How do i loop every single value in the “weapons” table?
Currently it just works with 1 value in my table, i want, that it loops through any value.

How many dimensions is it?


for k, v in pairs(weapons) do

should work for what you have shows here

Well, it works now.
I’ll better remove the addon, weird bugs happen (weapons in the air, pick-up-bugs).
Thanks for ya help!