How would i go about having FA:S 2 SWEP attachments in the pointshop ?
[CODE]
--code for attachment
if GAMEMODE_NAME == "terrortown" then
AddCSLuaFile()
if GetConVarNumber("ttt_fas2_att_suppressor_enabled") == 1 then
local suppressortbl = {
id = 2048, --ID for Suppressor
category = "TTT FA:S 2.0 Attachment",
tablename = "suppressor",
type = "Attachment",
material = "vgui/fas2atts/suppressor",
name = "Suppressor",
desc = "Decreases firing noise.\nDecreases recoil by 15%\nDecreases damage by 10%"
}
table.insert( AttachTable, suppressortbl )
if (GetConVarNumber("ttt_fas2_att_suppressor_aquire") == 0) then
if (GetConVarNumber("ttt_fas2_att_suppressor_available") == 0) and (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") != 1) then
table.insert( EquipmentItems[ ROLE_TRAITOR ], suppressortbl )
elseif GetConVarNumber("ttt_fas2_att_suppressor_available") == 1 and (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") != 2)then
table.insert( EquipmentItems[ ROLE_DETECTIVE ], suppressortbl )
elseif GetConVarNumber("ttt_fas2_att_suppressor_available") == 2 and (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") != 1) and (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") != 2)then
table.insert( EquipmentItems[ ROLE_TRAITOR ], suppressortbl )
table.insert( EquipmentItems[ ROLE_DETECTIVE ], suppressortbl )
end
end
if SERVER then
resource.AddFile( "materials/vgui/fas2atts/suppressor.vmt" )
util.AddNetworkString( "PlayerBoughtSupp" )
net.Receive( "PlayerBoughtSupp", function( len, plyr)
if plyr:IsPlayer() then
if not table.HasValue(plyr.FAS2Attachments, "suppressor" ) then
plyr:FAS2_PickUpAttachment("suppressor")
end
end
end )
end
if CLIENT then
hook.Add( "TTTBoughtItem", "SuppressorBoughtItem", function ( is_item, id )
if is_item and id == 2048 then
net.Start( "PlayerBoughtSupp" )
net.SendToServer()
end
end)
hook.Add( "TTTBeginRound", "SuppressorDefaultItem", function()
if (GetConVarNumber("ttt_fas2_att_suppressor_aquire") == 1) then
net.Start( "PlayerBoughtSupp" )
net.SendToServer()
end
if (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") == 1) and (GetConVarNumber("ttt_fas2_att_suppressor_aquire") == 0) and LocalPlayer():GetRole() == ROLE_TRAITOR then
net.Start( "PlayerBoughtSupp" )
net.SendToServer()
end
if (GetConVarNumber("ttt_fas2_att_suppressor_defaultfor") == 2) and (GetConVarNumber("ttt_fas2_att_suppressor_aquire") == 0) and LocalPlayer():GetRole() == ROLE_DETECTIVE then
net.Start( "PlayerBoughtSupp" )
net.SendToServer()
end
end)
end
end
end
[/CODE]
-vin
This would be so sick but probably a pain in the ass to setup, plus the fact that there are no w_models for guns with attachments on them.
Sorry, you need to Log In to post a reply to this thread.