My name is Andy, and I've recently been 'hired' as coder for an up-rising community called Hazardous Gaming.
I really like the gamemode, and most of the coding is easy to understand, which makes me happy as a newbie.
My problem is:
I'm trying to add FA:S 2 to the gamemode, and to the shop menu, and it worked pretty well... with the Glock 20. I've tried with several other weapons (AK47,AK74,G3A3,SKS), and each of them has different problems. And yes, I have been google'ing for hours without results, since noone really dares to try and edit this awesome gamemode. Hope you can help me.
Here's a list:
AK47:
- When bought, it's hovering above the ground, can't pick it up.
- When in equipment menu, it shows up as "AK-Composite.
AK74
- When bought, it's hovering above the ground, can't pick it up.
- When in equipment menu, it shows up as "AK-Composite.
G3A3:
- When bought, it's hovering above the ground, can't pick it up.
- When in equipment menu, it shows up as "AK-Composite.
SKS:
- Doesn't show up in the equipment-menu at all when pocketed.
Codes for the weapons:
AK47:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_ak47"
ITEM.Name = "AK-47"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 250
ITEM.Small_Parts = 280
ITEM.Chemicals = 170
ITEM.Chance = 100
ITEM.Info = "AK-47 the Father of all Russian Assault rifles. "
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 1
ITEM.Ent = "fas2_ak47"
ITEM.Model = "models/weapons/w_rif_ak47.mdl"
ITEM.Script = ""
ITEM.Weight = 6
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_762x39"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_ak47"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(0)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)
AK74:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_ak74"
ITEM.Name = "AK-74"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 200
ITEM.Small_Parts = 280
ITEM.Chemicals = 250
ITEM.Chance = 100
ITEM.Info = "AK-74 Is chambered in 5.45x39 which was inspired by 5.62 NATO "
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 1
ITEM.Ent = "fas2_ak74"
ITEM.Model = "models/weapons/w_rif_ak47.mdl"
ITEM.Script = ""
ITEM.Weight = 4
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_545x39"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_ak74"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(31)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)
G3A3:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_g3"
ITEM.Name = "HK G3"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 300
ITEM.Small_Parts = 360
ITEM.Chemicals = 280
ITEM.Chance = 100
ITEM.Info = "HK G3 is Chambered In 5.56 NATO And was used in almost every Conflict since 1959. "
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 1
ITEM.Ent = "fas2_g3"
ITEM.Model = "models/weapons/w_rif_ak47.mdl"
ITEM.Script = ""
ITEM.Weight = 6
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_556x45"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_g3"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(0)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)
SKS:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_sks"
ITEM.Name = "SKS"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 200
ITEM.Small_Parts = 300
ITEM.Chemicals = 200
ITEM.Chance = 100
ITEM.Info = "SKS Was the first Soviet attempt at creating a service rifle after 1944. Chambered in 7.62X39 "
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 1
ITEM.Ent = "fas2_sks"
ITEM.Model = "models/weapons/w_snip_awp.mdl"
ITEM.Script = ""
ITEM.Weight = 8
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_762x39"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_sks"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(0)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)
M24:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_m24"
ITEM.Name = "M24"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 200
ITEM.Small_Parts = 250
ITEM.Chemicals = 200
ITEM.Chance = 100
ITEM.Info = "The M24 is a 7.62X51 NATO Sniper rifle based on the Mauser Bolt action system."
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 1
ITEM.Ent = "fas2_m24"
ITEM.Model = "models/weapons/w_snip_awp.mdl"
ITEM.Script = ""
ITEM.Weight = 8
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_762x51"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_m24"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(0)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)
And Glock 20 just to compare:
- Code: Select all
local ITEM = {}
local WEAPON = {}
ITEM.ID = "fas2_glock20"
ITEM.Name = "Glock 20"
ITEM.ClassSpawn = "Engineer"
ITEM.Scrap = 90
ITEM.Small_Parts = 90
ITEM.Chemicals = 60
ITEM.Chance = 100
ITEM.Info = "Glock 20 secondary weapon favoured for its 10x25 Cartridge. This model looks like it's been made in the back of a shed."
ITEM.Type = "weapon"
ITEM.Remove = true
ITEM.Energy = 16
ITEM.Ent = "fas2_glock20"
ITEM.Model = "models/weapons/w_pist_glock18.mdl"
ITEM.Script = ""
ITEM.Weight = 4
ITEM.ShopHide = true
WEAPON.ID = ITEM.ID
WEAPON.AmmoType = "fas2_ammo_10x25"
function ITEM.ToolCheck( p )
return true
end
function ITEM.Use( ply )
local WepName = "fas2_glock20"
local gotWep = false
for k, v in pairs(ply:GetWeapons()) do
if v:GetClass() == WepName then gotWep = true end
end
if gotWep == false then
ply:Give(WepName)
ply:GetWeapon(WepName):SetClip1(0)
return true
else
ply:ChatPrint("Weapon already equipped.")
return false
end
end
function ITEM.Create( ply, class, pos )
local ent = ents.Create("ent_weapon")
--ent:SetNetworkedInt("Ammo", self.Energy)
ent:SetNWString("WepClass", ITEM.Ent)
ent:SetModel(ITEM.Model)
ent:SetAngles(Angle(0,0,0))
ent:SetPos(pos)
ent:Spawn()
return ent
end
PNRP.AddItem(ITEM)
PNRP.AddWeapon(WEAPON)