• Lua Error (New Flood Mod)
    2 replies, posted
Working on a custom gamemode for gmod13. Got this strange error [CODE] [ERROR] gamemodes/flood13/entities/weapons/gmod_tool/cl_init.lua:2: '=' expected near '<eof>' 1. unknown - gamemodes/flood13/entities/weapons/gmod_tool/cl_init.lua:0 [/CODE] cl_init.lua [CODE] local gmod_drawhelp = CreateClientConVar( "gmod_drawhelp", "1", true, false ) gmod_toolmode = CreateClientConVar( "gmod_toolmode", "rope", true, true ) include('shared.lua') include('cl_viewscreen.lua') SWEP.PrintName = "Tool Gun" SWEP.Slot = 5 SWEP.SlotPos = 6 SWEP.DrawAmmo = false SWEP.DrawCrosshair = true SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.WepSelectIcon = surface.GetTextureID( "vgui/gmod_tool" ) SWEP.Gradient = surface.GetTextureID( "gui/gradient" ) SWEP.InfoIcon = surface.GetTextureID( "gui/info" ) SWEP.ToolNameHeight = 0 SWEP.InfoBoxHeight = 0 surface.CreateFont( "GModToolName", { font = "coolvetica", size = 40, weight = 1000, antialias = true, italic = false, } ) surface.CreateFont( "GModToolSubtitle", { font = "coolvetica", size = 24, weight = 500, antialias = true, italic = false, } ) surface.CreateFont( "GModToolHelp", { font = "coolvetica", size = 19, weight = 500, antialias = true, italic = false, } ) /*--------------------------------------------------------- Draws the help on the HUD (disabled if gmod_drawhelp is 0) ---------------------------------------------------------*/ function SWEP:DrawHUD() if ( !gmod_drawhelp:GetBool() ) then return end local mode = gmod_toolmode:GetString() // Don't draw help for a nonexistant tool! if ( !self:GetToolObject() ) then return end self:GetToolObject():DrawHUD() // This could probably all suck less than it already does local x, y = 50, 40 local w, h = 0, 0 local TextTable = {} local QuadTable = {} QuadTable.texture = self.Gradient QuadTable.color = Color( 10, 10, 10, 120 ) QuadTable.x = 0 QuadTable.y = y-8 QuadTable.w = 600 QuadTable.h = self.ToolNameHeight - (y-8) draw.TexturedQuad( QuadTable ) TextTable.font = "GModToolName" TextTable.color = Color( 240, 240, 240, 255 ) TextTable.pos = { x, y } TextTable.text = "#Tool_"..mode.."_name" w, h = draw.TextShadow( TextTable, 3 ) y = y + h TextTable.font = "GModToolSubtitle" TextTable.pos = { x, y } TextTable.text = "#Tool_"..mode.."_desc" w, h = draw.TextShadow( TextTable, 2 ) y = y + h + 8 self.ToolNameHeight = y y = y + 1 QuadTable.x = 0 QuadTable.y = y QuadTable.w = 600 QuadTable.h = self.InfoBoxHeight local alpha = math.Clamp( 255 + (self:GetToolObject().LastMessage - CurTime())*800, 10, 255 ) QuadTable.color = Color( alpha, alpha, alpha, 140 ) draw.TexturedQuad( QuadTable ) y = y + 2 TextTable.font = "GModToolHelp" TextTable.pos = { x + self.InfoBoxHeight, y } TextTable.text = "#Tool_"..mode.."_"..self:GetToolObject():GetStage() w, h = draw.TextShadow( TextTable, 2 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetTexture( self.InfoIcon ) surface.DrawTexturedRect( x+1, y+1, h-3, h-3 ) self.InfoBoxHeight = h + 4 end function SWEP:SetStage( ... ) if ( !self:GetToolObject() ) then return end return self:GetToolObject():SetStage( ... ) end function SWEP:GetStage( ... ) if ( !self:GetToolObject() ) then return end return self:GetToolObject():GetStage( ... ) end function SWEP:ClearObjects( ... ) if ( !self:GetToolObject() ) then return end self:GetToolObject():ClearObjects( ... ) end function SWEP:StartGhostEntities( ... ) if ( !self:GetToolObject() ) then return end self:GetToolObject():StartGhostEntities( ... ) end function SWEP:PrintWeaponInfo( x, y, alpha ) end function SWEP:FreezeMovement() local mode = self:GetMode() if ( !self:GetToolObject() ) then return false end return self:GetToolObject():FreezeMovement() end [/CODE] Help please this gamemode is almost fully functional [editline]13th December 2012[/editline] Fixed it self some how. Now when I try to get the tool gun I throws [CODE] [ERROR] gamemodes/base/gamemode/cl_hudpickup.lua:17: attempt to call method 'GetPrintName' (a nil value) 1. unknown - gamemodes/base/gamemode/cl_hudpickup.lua:17 [/CODE] What?
I'm Having the Same problem with this How do i fix it for my Gmod 13 server
you not add local to 2 line. You - gmod_toolmode = CreateClientConVar( "gmod_toolmode", "rope", true, true ) My - local gmod_toolmode = CreateClientConVar( "gmod_toolmode", "rope", true, true )
Sorry, you need to Log In to post a reply to this thread.