Alright, so I could be completely misreading a large swath of Lua code, but many TTT weapons have block of code like this:
if CLIENT then SWEP.PrintName = "AK47" SWEP.Slot = 2 -- add 1 to get the slot number key SWEP.ViewModelFOV = 72 SWEP.ViewModelFlip = true end -- Always derive from weapon_tttbase. SWEP.Base = "weapon_tttbase"
Why is there an “if CLIENT then” conditional? These are just variables, are they not? Setting them outside of the conditional doesn’t seem like it should cause any harm.
So onto my question. I need to get the slot of a weapon in the pointshop of my server, because when players buy a weapon, it isn’t forcing the player to drop their previous weapon first. I can get players to drop their weapons, but only if I can read the Slot attribute on my custom weapons (for which I removed the “if CLIENT then” check). Is this possible? I’ve been trying things like this:
lua_run p = player:GetByID(5) lua_run p:SendLua("w = weapons.Get('weapon_ttt_ak47') ; print('say ' .. w.Slot)")
But I don’t even know how I would save w.Slot to a variable. Any ideas?