Error:
[code]
[ERROR] lua/addonname.lua:47: ')' expected (to close '(' at line 42) near 'end'
1. unknown - lua/addonname.lua:0
[/code]
Command to open the panel:
[code]if (CLIENT) then
net.Receive("__hkOpenDialog",function()
if LocalPlayer() == net.ReadEntity() then[/code]
[code]if (SERVER) then
local fcSendMsg = function(hPlayer)
util.AddNetworkString("__hkOpenDialog")
net.Start("__hkOpenDialog")
net.WriteEntity(hPlayer)
net.Broadcast()
end
hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText) --- Line 42
if sText == "!openmenu" then
fcSendMsg(hPlayer)
end
end
end) --- Line 47
end[/code]
Remove the end above --- Line 47
If you indent things correctly, ends won't stack on top of each other like they do there, if they do, then you know you did something wrong or chose to indent that way.
The error says what you should be doing-
[QUOTE=Athods;50005955]
[CODE]
hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText) --- Line 42
if sText == "!openmenu" then
fcSendMsg(hPlayer)
end
end -- this needs a bracket
end) --- why is the bracket here?
end -- what are you ending here[/code][/QUOTE]
[editline]26th March 2016[/editline]
ninja'd
[QUOTE=McDunkable;50006783]Remove the end above --- Line 47
If you indent things correctly, ends won't stack on top of each other like they do there, if they do, then you know you did something wrong or chose to indent that way.[/QUOTE]
Like this ? [code] hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText)
if sText == "!coinflip" then
fcSendMsg(hPlayer)
end
end ) --- Line 47
end
[/code]
Didnt work
thats the error now
[code]
[ERROR] lua/addonname.lua:48: 'end' expected (to close 'if' at line 5) near '<eof>'
1. unknown - lua/adonname.lua:0
[/code]
[QUOTE=Athods;50006969]Like this ? [code] hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText)
if sText == "!coinflip" then
fcSendMsg(hPlayer)
end
end ) --- Line 47
end
[/code]
Didnt work
thats the error now
[code]
[ERROR] lua/addonname.lua:51: 'end' expected (to close 'if' at line 5) near '<eof>'
1. unknown - lua/adonname.lua:0
[/code][/QUOTE]
Could you please provide us your (current) full code?
[QUOTE=CupCakeR;50006975]Could you please provide us your (current) full code?[/QUOTE]
thats almost my full code the only thing more i have its a panel ( [code]local NAME = vgui.Create ( "DFrame" ) [/code])
My full code
[code]-- Command
if (CLIENT) then
net.Receive("__hkOpenDialog",function()
if LocalPlayer() == net.ReadEntity() then
-- Start Coding
local openpanel = vgui.Create ( "DFrame" )
openpane:SetTitle("")
openpanel:SetSize(900,600)
openpanel:Center()
openpanel:MakePopup()
-- Command
if (SERVER) then
local fcSendMsg = function(hPlayer)
util.AddNetworkString("__hkOpenDialog")
net.Start("__hkOpenDialog")
net.WriteEntity(hPlayer)
net.Broadcast()
end
hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText)
if sText == "!openpanel" then
fcSendMsg(hPlayer)
end
end )
end [/code]
Try this:
[CODE]if (CLIENT) then
net.Receive("__hkOpenDialog",function()
if LocalPlayer() == net.ReadEntity() then
local openpanel = vgui.Create ( "DFrame" )
openpane:SetTitle("")
openpanel:SetSize(900,600)
openpanel:Center()
openpanel:MakePopup()
end
end)
end
if (SERVER) then
util.AddNetworkString("__hkOpenDialog")
local function fcSendMsg(hPlayer)
net.Start("__hkOpenDialog")
net.WriteEntity(hPlayer)
net.Broadcast()
end
hook.Add("PlayerSay","m_hkPlayerSayDialogCommand",function(hPlayer,sText)
if sText == "!openpanel" then
fcSendMsg(hPlayer)
end
end )
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.