• [ERROR] expected near ')'
    5 replies, posted
So, I have been working on a menu for a while and one of my menus are not working. I keep on getting the same exact error "[ERROR] expected near ')' 1. unknown - lua/nlrstuff.lua:0", but I don't know WHERE exactly the error is! I've tried everything! This is the script right here: [CODE] if SERVER then AddCSLuaFile() util.AddNetworkString("CraftingMenu") hook.Add("PlayerSay", "Crafting", function ( ply ) net.Start( "CraftingMenu" ) net.Send( ply ) end ) concommand.Add( "CraftWeapon", function( ply, cmd, args, argStr ) --Metal Shard + ShardList( args[1] ) if ( ShardList[args[2] <= CurrentPlayerShards ) then --If the amount of shards needed is less than or equal too the current amount, then give the weapon ply:Give( WeaponList[ tonumber( args[1] ) ] ) else print("You do not have enough shards!") end end ) elseif CLIENT then ----------------------------------------------------------- --Weapons List config, config to your will, my friend!----- ----------------------------------------------------------- local WeaponList = {} WeaponList[1] = "m9k_intervention" --Intervention WeaponList[2] = "m9k_dbarrel" --Double Barrel Shotgun WeaponList[3] = "m9k_browningauto5" --Browning Auto 5 WeaponList[4] = "m9k_m60" --M60 WeaponList[5] = "m9k_val" --AS Val WeaponList[6] = "m9k_m16a4_acog" --M16A4 ACOG WeaponList[7] = "m9k_famas" --Famas WeaponList[8] = "m9k_ak47" --Ak-47 WeaponList[9] = "m9k_winchester73" --Winchester-73 WeaponList[10] = "m9k_m4a1" --M4A1 WeaponList[11] = "m9k_glock" --Glock WeaponList[12] = "m9k_deagle" --Deagle WeaponList[13] = "m9k_ragingbull" --Raging Bull ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- --# o/ Shard List config, config to your will, my friend!-- ----------------------------------------------------------- local ShardList = {} ShardList[1] = 5 --Intervention ShardList[2] = 4 --Double Barrel Shotgun ShardList[3] = 3 --Browning Auto 5 ShardList[4] = 6 --M60 ShardList[5] = 2 --AS Val ShardList[6] = 2 --M16A4 ACOG ShardList[7] = 2 --Famas ShardList[8] = 3 --Ak-47 ShardList[9] = 4 --Winchester-73 ShardList[10] = 2 --M4A1 ShardList[11] = 1 --Glock ShardList[12] = 2 --Deagle ShardList[13] = 2 --Raging Bull ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- local blurmat = Material( "pp/blurscreen" ) local function LayerBlur( panel, layers, density, alpha ) local x, y = panel:LocalToScreen(0, 0) surface.SetDrawColor( 255, 255, 255, alpha ) surface.SetMaterial( blurmat ) for i = 1, 3 do blurmat:SetFloat( "$blur", ( i / layers ) * density ) blurmat:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect( -x, -y, ScrW(), ScrH() ) end end local DermaBG = vgui.Create( "DFrame" ) DermaBG:SetSize( ScrW(), ScrH() ) DermaBG:SetPos( 0, 0 ) DermaBG:SetTitle( "" ) DermaBG:SetDraggable( false ) DermaBG:MakePopup() DermaBG:Hide() DermaBG:ShowCloseButton( false ) function DermaBG:Paint( w, h ) LayerBlur( self, 10, 20, 255 ) end local DermaPanel = vgui.Create( "DFrame", DermaBG ) DermaPanel:SetSize( ScrW()*0.70, ScrH()*0.70 ) DermaPanel:SetPos( ScrW()/2 - DermaPanel:GetWide()/2, ScrH()/2 - DermaPanel:GetTall()/2 ) DermaPanel:SetTitle( "Craftable Weapons" ) DermaPanel:SetDraggable( false ) DermaPanel:MakePopup() DermaPanel:ShowCloseButton( false ) local function HidePanel() surface.PlaySound( "garrysmod/balloon_pop_cute.wav" ) DermaBG:Hide() end local function ShowPanel() surface.PlaySound( "garrysmod/balloon_pop_cute.wav" ) DermaBG:Show() end local DButton = vgui.Create( "DButton", DermaPanel) DButton:SetPos( 0, 0 ) DButton:SetText( "Close" ) DButton:SetSize( DermaPanel:GetWide(), DermaPanel:GetTall()*0.03 ) DButton.DoClick = function() HidePanel() end local AppList = vgui.Create( "DListView", DermaPanel ) AppList:SetSize(DermaPanel:GetWide(), DermaPanel:GetTall()*0.97) AppList:SetPos( 0, DermaPanel:GetTall()*0.03) AppList:SetMultiSelect( false ) AppList:AddColumn( "Weapons" ) AppList:AddLine("Intervention") AppList:AddLine("Double Barrel Shotgun") AppList:AddLine("Browning Auto 5") AppList:AddLine("M60") AppList:AddLine("AS Val") AppList:AddLine("M16A4 ACOG") AppList:AddLine("Famas") AppList:AddLine("Ak-47") AppList:AddLine("Winchester-73") AppList:AddLine("M4A1") AppList:AddLine("Glock") AppList:AddLine("Deagle") AppList:AddLine("Raging Bull") function AppList:DoDoubleClick( lineID, line ) -- lineID = the line you doubleclick on surface.PlaySound( "phx/hmetal3.wav" ) LocalPlayer():ConCommand( "CraftWeapon " .. lineID ) LocalPlayer():removePocketItem( ShardList( args[1] ) ) AppList:AddColumn( "Metal Shards" ) AppList:AddLine("5") --Intervention AppList:AddLine("4") --Double Barrel Shotgun AppList:AddLine("3") --Browning Auto 5 AppList:AddLine("6") --M60 AppList:AddLine("2") --AS Val AppList:AddLine("2") --M16A4 ACOG AppList:AddLine("2") --Famas AppList:AddLine("3") --Ak-47 AppList:AddLine("4") --Winchester-73 AppList:AddLine("2") --M4A1 AppList:AddLine("1") --Glock AppList:AddLine("2") --Deagle AppList:AddLine("2") --Raging Bull net.Receive( "CraftingMenu", function() ShowPanel() end ) end [/CODE]
Depending on what you want to do, you either never closed AppList:DoDoubleClick or you didn't close the if statement at the very top: if SERVER then ... elseif CLIENT then ... Also, post the full error message.
[QUOTE=McDunkable;50022788]Depending on what you want to do, you either never closed AppList:DoDoubleClick or you didn't close the if statement at the very top: if SERVER then ... elseif CLIENT then ... Also, post the full error message.[/QUOTE] [ERROR] expected near ')' 1. unknown - lua/nlrstuff.lua:0
Is that seriously the whole error? That doesn't look like the full error.. It's usually [ERROR] expected "a" near "b" Then a trace to the error Regardless, try what I said, you have a syntax error and a logic error, I assume you want to close the function AppList:DoDoubleClick judging by the (poor) indentation. Add an end after this line "LocalPlayer():removePocketItem( ShardList( args[1] ) )" and it should work.
[QUOTE=McDunkable;50022916]Is that seriously the whole error? That doesn't look like the full error.. It's usually [ERROR] expected "a" near "b" Then a trace to the error Regardless, try what I said, you have a syntax error and a logic error, I assume you want to close the function AppList:DoDoubleClick judging by the (poor) indentation. Add an end after this line "LocalPlayer():removePocketItem( ShardList( args[1] ) )" and it should work.[/QUOTE] Still an error
Approx. line 16. [code] if ( ShardList[args[2] <= CurrentPlayerShards ) [/code] Should be (You missed a ]) [code] if ( ShardList[args[2]] <= CurrentPlayerShards ) [/code] In addition to above, the line [code]LocalPlayer():removePocketItem( ShardList( args[1] ) )[/code] should be (You were using () instead of []) [code]LocalPlayer():removePocketItem( ShardList[args[1]])[/code]
Sorry, you need to Log In to post a reply to this thread.