I'm using this script:
if SERVER then
AddCSLuaFile();
else
local oWeaponsGetList = weapons.GetList;
function weapons.GetList()
local tbl = oWeaponsGetList();
if( !IsValid( LocalPlayer() ) ) then
return tbl;
end
local grp = LocalPlayer():GetUserGroup();
if( string.find( tostring( debug.traceback() ), "GetEquipmentForRole" ) != nil ) then
for k,v in pairs( tbl ) do
if( v and v.CanBuy ) then
if( v.GroupOnly and v.Groups ) then
if( !table.HasValue( v.Groups, grp ) ) then
table.remove( tbl, k );
end
end
end
end
end
return tbl;
end
end
But it causes people who do not have a certain rank to not see these weapons, and I would like everyone to see them in the T-Shop, but only VIPs could buy them.
Does anyone know how to do it?
You shouldn't mess with these tables.
The script I sent above has been working for me for a year now, but now I would like to do it so that players who do not have the vip rank also see these weapons, it seems to me that doing this would not be based on this tables anymore, but I have no idea how to do it.
Well, now i have this
hook.Add( "TTTCanOrderEquipment", "GroupOnlyWeapons", function( ply, wep )
wep = weapons.GetStored(wep)
if wep.GroupOnly then
return false
end
end )
But this is giving me error
attempt to index local 'wep' (a nil value)
Pls help
You need to check if wep is not nil before checking GroupOnly.
I was using this method for awhile but it caused Decoys, Radars and one other thing to not be purchaseable also rayek for where you got that from you need like 3 different lua files for that to work
I had to use the first post code and the new code one in lua/autorun and one in lua/autorun/server as well as i had clientside code from that post the 2nd code you posted is the one to go inside server
You can post that codes here?
I can but im not sure its the best method as it will make it so The first 3 T items are unpurchaseable eg the radar decoy and whatever else is up there if you still want them let me know
Okay I got this, @code_gs was right.
Sorry, you need to Log In to post a reply to this thread.