Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 07:28:25 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: AK47 script throws an error
Pages: [1]
Author Topic: AK47 script throws an error  (Read 8169 times)
k9rosie
Poster

Posts: 27


« on: July 12, 2011, 02:49:14 PM »


This is pretty much the M4A1 script with changed sound, model, and vector values to match the ak47. Whenever I pick one up, my gui dissapears and throws the following error:

Quote
[terrortown\gamemode\cl_wepswitch.lua:101] attempt to call method 'Ammo1' (a nil value)(Hook: HUDPaint)


The ammo values are the same from the M4A1 and the M4A1 runs fine.




if SERVER then

  AddCSLuaFile( "shared.lua" )
end

SWEP.HoldType = "ar2"
 

if CLIENT then

  SWEP.PrintName = "AK47"
  SWEP.Slot = 2

  SWEP.Icon = "VGUI/ttt/icon_ak47"
end


SWEP.Base = "weapon_tttbase"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.Kind = WEAPON_HEAVY

SWEP.Primary.Delay = 0.19
SWEP.Primary.Recoil = 1.6
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "Pistol"
SWEP.Primary.Damage = 23
SWEP.Primary.Cone = 0.02
SWEP.Primary.ClipSize = 20
SWEP.Primary.ClipMax = 60
SWEP.Primary.DefaultClip = 20
SWEP.AutoSpawnable      = true
SWEP.AmmoEnt = "item_ammo_pistol_ttt"
SWEP.ViewModel = "models/weapons/v_rif_ak47.mdl"
SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl"

SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" )

SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 )
SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 )


function SWEP:SetZoom(state)
  if CLIENT then return end
  if state then
     self.Owner:SetFOV(35, 0.5)
  else
     self.Owner:SetFOV(0, 0.2)
  end
end

-- Add some zoom to ironsights for this gun
function SWEP:SecondaryAttack()
  if not self.IronSightsPos then return end
  if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
 
  bIronsights = not self:GetIronsights()
 
  self:SetIronsights( bIronsights )
 
  if SERVER then
     self:SetZoom(bIronsights)
  end
 
  self.Weapon:SetNextSecondaryFire(CurTime() + 0.3)
end

function SWEP:PreDrop()
  self:SetZoom(false)
  self:SetIronsights(false)
  return self.BaseClass.PreDrop(self)
end

function SWEP:Reload()
  self.Weapon:DefaultReload( ACT_VM_RELOAD );
  self:SetIronsights( false )
  self:SetZoom(false)
end


function SWEP:Holster()
  self:SetIronsights(false)
  self:SetZoom(false)
  return true
end


« Last Edit: July 14, 2011, 05:20:01 PM by k9rosie »
k9rosie
Poster

Posts: 27


« Reply #1 on: July 14, 2011, 05:20:41 PM »

I get this with other weapons too and traitor weapons don't like to show up on the shop.
KingLinkTiger
Poster

Posts: 4


« Reply #2 on: July 14, 2011, 10:37:19 PM »

I have the same problem. I even tried to copy the C4 code and just make a second c4 called c42. With the same code, other than the name of the weapon, I got the same error.
k9rosie
Poster

Posts: 27


« Reply #3 on: July 14, 2011, 10:48:15 PM »

Glad I'm not the only one.
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #4 on: July 15, 2011, 12:34:45 AM »

If i remember correctly, this is to do with CSS mounting incorrectly, try reinstalling the CSS content on your server.

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
k9rosie
Poster

Posts: 27


« Reply #5 on: July 15, 2011, 12:54:50 AM »

If i remember correctly, this is to do with CSS mounting incorrectly, try reinstalling the CSS content on your server.


Seriously? I had to wait 2 days for technical support to install the CS:S content and now they have to install it again?
KingLinkTiger
Poster

Posts: 4


« Reply #6 on: July 15, 2011, 01:08:19 AM »

If i remember correctly, this is to do with CSS mounting incorrectly, try reinstalling the CSS content on your server.
I'll do that and report back later.
k9rosie
Poster

Posts: 27


« Reply #7 on: July 15, 2011, 01:24:35 AM »

I'll do that and report back later.

Yes, please do tell me if this works.
KingLinkTiger
Poster

Posts: 4


« Reply #8 on: July 15, 2011, 01:54:28 AM »

Nope. I still get the following Error:

[terrortown\gamemode\cl_wepswitch.lua:101] attempt to call method 'Ammo1' (a nil value)(Hook: HUDPaint)


I deleted the entire CS:S file and reinstalled it.
k9rosie
Poster

Posts: 27


« Reply #9 on: July 15, 2011, 05:08:56 PM »

:(
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #10 on: July 15, 2011, 05:49:58 PM »

The function Ammo1 is defined in the tttbase weapon. Something pretty fundamental has to go wrong for that function not to exist on your weapon. There might be a lua error in the console that shows immediately after the map and the gamemode load.
k9rosie
Poster

Posts: 27


« Reply #11 on: July 15, 2011, 06:07:15 PM »

Here are some lua errors that pop up after lua is inited:
Quote
Lua initialized (Lua 5.1)
LuaGetfile: Not Loading autorun/
Couldn't include file 'autorun/' (File not found) (<nowhere>)
LuaGetfile: Not Loading autorun/client/
Couldn't include file 'autorun/client/' (File not found) (<nowhere>)
LuaGetfile: Not Loading postprocess/
Couldn't include file 'postprocess/' (File not found) (<nowhere>)
LuaGetfile: Not Loading vgui/
Couldn't include file 'vgui/' (File not found) (<nowhere>)
Included TTT language file: chef.lua
Included TTT language file: english.lua
Registering gamemode 'fretta' derived from 'base'
Registering gamemode 'terrortown' derived from 'fretta'
TTT Client initializing...
Sending 12 'User Info' ConVars to server (cl_spewuserinfoconvars to see)
Scanning for downloaded fonts..
Reloading Particles..
Hey 'k9rosie' - You're in the 'superadmin' group on this server.
Client "[Red Vinyl] k9rosie" spawned in server (72.177.93.240:27005)<STEAM_0:1:25111336>.
Welcome to Red Vinyl [TTT] [FastDL]! We're playing ttt_minecraft_b3.
Warning: Unhandled usermessage 'ULStart'
Warning: Unhandled usermessage 'ULPacket'
W
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #12 on: July 15, 2011, 08:46:17 PM »

There's no TTT-related error there, though the "couldn't include" stuff might point to a gmod issue.

I've just tested the script you posted and it works fine for me. So it looks like it's some sort of install/configuration issue with gmod or the server. Maybe scriptenforcer.
k9rosie
Poster

Posts: 27


« Reply #13 on: July 15, 2011, 09:00:35 PM »

There's no TTT-related error there, though the "couldn't include" stuff might point to a gmod issue.

I've just tested the script you posted and it works fine for me. So it looks like it's some sort of install/configuration issue with gmod or the server. Maybe scriptenforcer.


So should I disable script enforcer? Or reinstall the gmod server?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #14 on: July 15, 2011, 09:18:09 PM »

I don't know. I don't operate a server myself, nor do I have a big book of solutions to gmod problems.
k9rosie
Poster

Posts: 27


« Reply #15 on: July 15, 2011, 09:22:50 PM »

I'm going to try both and then see what happens.
k9rosie
Poster

Posts: 27


« Reply #16 on: July 15, 2011, 10:22:46 PM »

Okay so I did both of these and the AK47 still doesn't work for me.
It works fine for my friend though, so I'm wondering, is this a problem with me? Because I'm on a Mac and most likely he's on Windows.
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #17 on: July 18, 2011, 09:02:35 AM »

strong>Mac


Theres your problem.
Did you pay 199.95 for GMod on mac?

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
k9rosie
Poster

Posts: 27


« Reply #18 on: July 20, 2011, 03:16:53 PM »

Theres your problem.
Did you pay 199.95 for GMod on mac?


Yes, this was my problem.

After switching to my PC the SWEPs started working.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: AK47 script throws an error « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.