So I'm creating a new gamemode and I started working on a derma script. Satisfied with the code I ran my server and got this error:
gamemode/roleplay/gamemode/cl_init.lua:9: '(' expected near 'DTut'
For more than an hour. I went to every lua code checker and every friend I new that knew lua and go no answer. If you could lend me a hand PLEASE do.
-Maverick
Derma Code:
local DButton1
local DTut
local DFrame1
DButton1 = vgui.Create('DButton')
DButton1:SetSize(70, 25)
DButton1:Center()
DButton1:SetText('Done')
DButton1.DoClick = function DTut() local ply = LocalPlayer() ply:ConCommand("setinfo name "..TextEntry:GetValue()) end
DTUT = vgui.Create('DTextEntry')
DTUT:SetSize(115, 20)
DTUT:Center()
DTUT:SetText('Roleplay Name')
DTUT.OnEnter = function() end
DFrame1 = vgui.Create('DFrame')
DFrame1:SetSize(237, 103)
DFrame1:Center()
DFrame1:SetTitle('Enter An Roleplay Name')
DFrame1:SetSizable(true)
DFrame1:SetDeleteOnClose(false)
DFrame1:ShowCloseButton(false)
DFrame1:MakePopup()
[QUOTE=maverick_may;44436054][lua]DButton1.DoClick = function DTut() local ply = LocalPlayer() ply:ConCommand("setinfo name "..TextEntry:GetValue()) end[/lua][/QUOTE]
When you are assigning a function to a variable, you don't give the function a name (remove DTut)
[lua]DButton1.DoClick = function() local ply = LocalPlayer() ply:ConCommand("setinfo name "..TextEntry:GetValue()) end[/lua]
There are other mistakes in your code, but that should fix the issue you've asked about.
"Enter An Roleplay Name"
This is frustrating me, please change it too
"Enter a roleplay name"
If I was to ever join your server, and I saw that, I would leave instantly
[QUOTE=AnonTakesOver;44438214]"Enter An Roleplay Name"
This is frustrating me, please change it [B]too[/B]
"Enter a roleplay name"
If I was to ever join your server, and I saw that, I would leave instantly[/QUOTE]
Your english isn't perfect either, stop hating.
[QUOTE=brandonj4;44438246]Your english isn't perfect either, stop hating.[/QUOTE]
Oh...burn.
Yeah, my English is far behind perfect, but when people use a/an and write Like This For No Reason, that annoys me, just a pet peeve
Anon I make it with the capital letters because I feel it would look more formal, and if you wanted to be a grammar Nazis I could look into changing it.
Sorry, you need to Log In to post a reply to this thread.