So, my servers been doing ok with not real game breaking lua errors but there are still a few that effect some players and thought i might post here for help see if anyone would... Here they are.
[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_crossbow/shared.lua:224: attempt to compare number with boolean
1. FireBolt - gamemodes/terrortown/entities/weapons/weapon_ttt_crossbow/shared.lua:224
2. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_crossbow/shared.lua:111
[QUOTE] function SWEP:FireBolt()
if ( self.Weapon:Clip1() <= 0 && self.Primary.ClipSize > -1 ) then
if ( self:Ammo1() > 3 ) then [B]-- THIS IS LINE 224[/B]
self:Reload();
self:ShootBullet( 150, 1, 0.01 )
else
self.Weapon:SetNextPrimaryFire( 5 );
end
return;
end
local pOwner = self.Owner;
if ( pOwner == NULL ) then
return;
end
if ( !CLIENT ) then
local vecAiming = pOwner:GetAimVector();
local vecSrc = pOwner:GetShootPos();
local angAiming;
angAiming = vecAiming:Angle();
local pBolt = ents.Create ( self.Primary.AmmoType );
pBolt:SetPos( vecSrc );
pBolt:SetAngles( angAiming );
pBolt.Damage = self.Primary.Damage;
self:ShootBullet( 150, 1, 0.01 )
pBolt.AmmoType = self.Primary.Ammo;
pBolt:SetOwner( pOwner );
pBolt:Spawn()
if ( pOwner:WaterLevel() == 3 ) then
pBolt:SetVelocity( vecAiming * BOLT_WATER_VELOCITY );
else
pBolt:SetVelocity( vecAiming * BOLT_AIR_VELOCITY );
end
end
self:TakePrimaryAmmo( self.Primary.NumAmmo );
if ( !pOwner:IsNPC() ) then
pOwner:ViewPunch( Angle( -2, 0, 0 ) );
end
self.Weapon:EmitSound( self.Primary.Sound );
self.Owner:EmitSound( self.Primary.Special2 );
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK );
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay );
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay );
// self:DoLoadEffect();
// self:SetChargerState( CHARGER_STATE_DISCHARGE );
end[/QUOTE]
And then theres this one which alot of people get from joining and they get "To many lua errors" this is TTT Damage Logs/RDM Manager: [url]http://facepunch.com/showthread.php?t=1301766[/url]
[ERROR] addons/damagelog-master/lua/cl_tabs/damagetab.lua:347: attempt to call method 'CanUseDamagelog' (a nil value)
1. func - addons/damagelog-master/lua/cl_tabs/damagetab.lua:347
2. unknown - lua/includes/modules/net.lua:31
[QUOTE]net.Receive("DL_RefreshDamagelog", function()
local tbl = net.ReadTable()
if not LocalPlayer():CanUseDamagelog() then return end -- [B]THIS IS LINE 347[/B]
if ValidPanel(Damagelog.Damagelog) then
local lines = Damagelog.Damagelog:GetLines()
if lines[1] and lines[1]:GetValue(3) == "Damagelog empty.." then
Damagelog.Damagelog:Clear()
end
local rounds = Damagelog:GetSyncEnt():GetPlayedRounds()
if rounds == Damagelog.SelectedRound then
Damagelog:AddLogsLine(Damagelog.Damagelog, tbl)
end
end
end)[/QUOTE]
And Finaly... Tihs one....
[ERROR] lua/includes/modules/draw.lua:76: bad argument #1 to 'GetTextSize' (string expected, got nil)
1. GetTextSize - [C]:-1
2. SimpleText - lua/includes/modules/draw.lua:76
3. unknown - gamemodes/terrortown/gamemode/vgui/sb_main.lua:734
[QUOTE]function SimpleText(text, font, x, y, colour, xalign, yalign)
font = font or "DermaDefault"
x = x or 0
y = y or 0
xalign = xalign or TEXT_ALIGN_LEFT
yalign = yalign or TEXT_ALIGN_TOP
local w, h = 0, 0
surface.SetFont(font)
if (xalign == TEXT_ALIGN_CENTER) then
w, h = surface.GetTextSize( text )
x = x - w/2
elseif (xalign == TEXT_ALIGN_RIGHT) then
w, h = surface.GetTextSize( text ) [B]-- THIS IS LINE 76[/B]
x = x - w
end
if (yalign == TEXT_ALIGN_CENTER) then
w, h = surface.GetTextSize( text )
y = y - h/2
elseif ( yalign == TEXT_ALIGN_BOTTOM ) then
w, h = surface.GetTextSize( text );
y = y - h;
end
surface.SetTextPos( math.ceil( x ), math.ceil( y ) );
if (colour!=nil) then
local alpha = 255
if (colour.a) then alpha = colour.a end
surface.SetTextColor( colour.r, colour.g, colour.b, alpha )
else
surface.SetTextColor(255, 255, 255, 255)
end
surface.DrawText(text)
return w, h
end[/QUOTE]
Help for any of the above would be grate the damage logs and the 3rd one are the most anoying
1. Looks fine to me.
2. Where is CanUseDamagelog() defined?
3. -What Robotboy655 said-
Also, for future reference, put all code in [code] tags, not [quote].
1) Post the whole code
2) What code_gs said
3) You posted wrong file, post sb_main.lua:734
1. doesn't cause crashes but happens a lot.
2. I don't know Lua assuming defined is something to do with Lua.
3. Here is that line how ever this is a custom scoreboard so i can't really post more if i can't get help there i will ask the creator.
[CODE]draw.SimpleText(custom_rank, "smallest", x + 247, y + 17, custom_rank_C, TEXT_ALIGN_RIGHT)[/CODE]
1. Post the whole code.
2. Post the whole code.
1) So what? I asked for the code, not if it crashes or not. if self:Ammo1() returns a bool, it must be overridden somewhere.
2) Where did you even get that addon? Something tells me it's outdated.
3) custom_rank variable appears to be nil in some cases, I can't help you more then that without the rest of the code.
1.
[CODE]if SERVER then
AddCSLuaFile( "shared.lua" )
end
SWEP.HoldType = "crossbow"
BOLT_MODEL = "models/crossbow_bolt.mdl"
BOLT_AIR_VELOCITY = 3500
BOLT_WATER_VELOCITY = 1500
BOLT_SKIN_NORMAL = 0
BOLT_SKIN_GLOW = 1
CROSSBOW_GLOW_SPRITE = "sprites/light_glow02_noz.vmt"
CROSSBOW_GLOW_SPRITE2 = "sprites/blueflare1.vmt"
if CLIENT then
SWEP.PrintName = "Silenced Crossbow"
SWEP.Author = "Urban"
SWEP.Slot = 6
SWEP.SlotPos = 1
SWEP.IconLetter = "w"
SWEP.Icon = "VGUI/ttt/icon_crossbow"
SWEP.ViewModelFlip = false
end
if SERVER then
resource.AddFile("materials/VGUI/ttt/icon_crossbow.vmt")
end
SWEP.Base = "weapon_tttbase"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Kind = WEAPON_ROLE
SWEP.AutoReload = true
SWEP.Primary.Tracer = 1
SWEP.Primary.Delay = 1
SWEP.Primary.Recoil = 5
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "XBowBolt"
SWEP.Primary.Damage = 100
SWEP.Primary.NumShots = 1
SWEP.Primary.NumAmmo = SWEP.Primary.NumShots
SWEP.Primary.Force = 10000000
SWEP.Primary.Cone = 0.001
SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 0
SWEP.Primary.ClipMax = 3
SWEP.AutoReload = false
SWEP.AmmoEnt = ""
SWEP.Primary.AmmoType = "crossbow_bolt"
SWEP.AutoSpawnable = false
SWEP.ViewModel = "models/weapons/v_crossbow.mdl"
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 65
SWEP.Primary.Reload = Sound( "Weapon_Crossbow.Reload" )
SWEP.Primary.Sound = Sound ("Weapon_Crossbow.Single")
SWEP.Primary.Special1 = Sound( "Weapon_Crossbow.BoltElectrify" )
SWEP.Primary.Special2 = Sound( "Weapon_Crossbow.BoltFly" )
--SWEP.IronSightsPos = Vector( 5, 0, 1 )
SWEP.IronSightsPos = Vector(0, 0, -15)
SWEP.CanBuy = { ROLE_TRAITOR }
SWEP.LimitedStock = true
SWEP.fingerprints = {}
SWEP.EquipMenuData = {
type = "Weapon",
model="models/weapons/w_crossbow.mdl",
desc = "Crossbow Silenced. \n Bam and they're dead!\nMade by Urban."
};
SWEP.AllowDrop = true
SWEP.AllowPickup = false
SWEP.IsSilent = true
SWEP.PrimaryAnim = ACT_VM_PRIMARYATTACK_SILENCED
SWEP.ReloadAnim = ACT_VM_RELOAD_SILENCED
function SWEP:Precache()
util.PrecacheSound( "Weapon_Crossbow.BoltHitBody" );
util.PrecacheSound( "Weapon_Crossbow.BoltHitWorld" );
util.PrecacheSound( "Weapon_Crossbow.BoltSkewer" );
util.PrecacheModel( CROSSBOW_GLOW_SPRITE );
util.PrecacheModel( CROSSBOW_GLOW_SPRITE2 );
self.BaseClass:Precache();
end
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
if ( self.m_bInZoom && IsMultiplayer() ) then
// self:FireSniperBolt();
self:FireBolt();
else
self:FireBolt();
end
// Signal a reload
self.m_bMustReload = true;
end
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW_SILENCED)
return true
end
function SWEP:SetZoom(state)
if CLIENT then
return
else
if state then
self.Owner:SetFOV(20, 0.3)
else
self.Owner:SetFOV(0, 0.2)
end
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:SetIronsights( false )
self:SetZoom(false)
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
if CLIENT then
local scope = surface.GetTextureID("sprites/scope")
function SWEP:DrawHUD()
if self:GetIronsights() then
surface.SetDrawColor( 0, 0, 0, 255 )
local x = ScrW() / 2.0
local y = ScrH() / 2.0
local scope_size = ScrH()
-- crosshair
local gap = 80
local length = scope_size
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
gap = 0
length = 50
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-- cover edges
local sh = scope_size / 2
local w = (x - sh) + 2
surface.DrawRect(0, 0, w, scope_size)
surface.DrawRect(x + sh - 2, 0, w, scope_size)
surface.SetDrawColor(255, 0, 0, 255)
surface.DrawLine(x, y, x + 1, y + 1)
-- scope
surface.SetTexture(scope)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)
else
return self.BaseClass.DrawHUD(self)
end
end
function SWEP:AdjustMouseSensitivity()
return (self:GetIronsights() and 0.2) or nil
end
end
function SWEP:FireBolt()
if ( self.Weapon:Clip1() <= 0 && self.Primary.ClipSize > -1 ) then
if ( self:Ammo1() > 3 ) then
self:Reload();
self:ShootBullet( 150, 1, 0.01 )
else
self.Weapon:SetNextPrimaryFire( 5 );
end
return;
end
local pOwner = self.Owner;
if ( pOwner == NULL ) then
return;
end
if ( !CLIENT ) then
local vecAiming = pOwner:GetAimVector();
local vecSrc = pOwner:GetShootPos();
local angAiming;
angAiming = vecAiming:Angle();
local pBolt = ents.Create ( self.Primary.AmmoType );
pBolt:SetPos( vecSrc );
pBolt:SetAngles( angAiming );
pBolt.Damage = self.Primary.Damage;
self:ShootBullet( 150, 1, 0.01 )
pBolt.AmmoType = self.Primary.Ammo;
pBolt:SetOwner( pOwner );
pBolt:Spawn()
if ( pOwner:WaterLevel() == 3 ) then
pBolt:SetVelocity( vecAiming * BOLT_WATER_VELOCITY );
else
pBolt:SetVelocity( vecAiming * BOLT_AIR_VELOCITY );
end
end
self:TakePrimaryAmmo( self.Primary.NumAmmo );
if ( !pOwner:IsNPC() ) then
pOwner:ViewPunch( Angle( -2, 0, 0 ) );
end
self.Weapon:EmitSound( self.Primary.Sound );
self.Owner:EmitSound( self.Primary.Special2 );
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK );
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay );
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay );
// self:DoLoadEffect();
// self:SetChargerState( CHARGER_STATE_DISCHARGE );
end
function SWEP:CanPrimaryAttack()
return true
end
function SWEP:SetDeploySpeed( speed )
self.m_WeaponDeploySpeed = tonumber( speed / GetConVarNumber( "phys_timescale" ) )
self.Weapon:SetNextPrimaryFire( CurTime() + speed )
self.Weapon:SetNextSecondaryFire( CurTime() + speed )
end
function SWEP:WasBought(buyer)
if IsValid(buyer) then -- probably already self.Owner
buyer:GiveAmmo( 3, "XBowBolt" )
end
end [/CODE]
2. [CODE]local function AAText(text, font, x, y, color, align)
draw.SimpleText(text, font, x+1, y+1, Color(0,0,0,math.min(color.a,120)), align)
draw.SimpleText(text, font, x+2, y+2, Color(0,0,0,math.min(color.a,50)), align)
draw.SimpleText(text, font, x, y, color, align)
end
local cur_selected
function Damagelog:DrawDamageTab(x, y)
local function askLogs()
if not self.SelectedRound then return end
self.Damagelog:Clear()
self.Damagelog:AddLine("", "", "Loading..")
self.loading = {}
self.receiving = true
net.Start("DL_AskDamagelog")
net.WriteUInt(self.SelectedRound, 32)
net.SendToServer()
end
self.DamageTab = vgui.Create(
2. CanUseDamagelog() is never defined anywhere. It's only on that one line that's causing the error.
[QUOTE=code_gs;43353601]2. CanUseDamagelog() is never defined anywhere. It's only on that one line that's causing the error.[/QUOTE]
So, do i just delete it ?
You can try.
[QUOTE=code_gs;43353601]2. CanUseDamagelog() is never defined anywhere. It's only on that one line that's causing the error.[/QUOTE]
So, do i just delete it ?
[editline]30th December 2013[/editline]
[QUOTE=Vincii;43354340]So, do i just delete it ?[/QUOTE]
My bad repost
That or you could define it yourself. Looks like it's just a replacement for IsAdmin an IsSuperAdmin.
Sorry, you need to Log In to post a reply to this thread.