Error
[code]autorun\server\getinfo.lua:3: attempt to call field 'UniqueID' (a nil value)[/code]
Line 3 - server
[code]file.Write( "CityLife/"..ply:UniqueID()..".txt" , ply:Nick().." \nGame Name: "..args[1].. " \nPass: "..args[2].." \nEmail: "..args[3])[/code]
Command - client
[code]RunConsoleCommand( "sendaccountinfo", NameInput:GetValue(), PassInput:GetValue(), EmailInput:GetValue() )
[/code]
what is wrong here, why do i get a error
Apparently "ply" isn't a player, which is weird. Can you show us how you assign it?
He showed it to me, it's one of the function parameters. (function( ply, command, args ) )
Post the whole code or we can't help you.
clientside
[lua]
function createacc( ply )
//FRAME CREATE
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 260,200 )
DermaPanel:SetSize( 460, 130 )
DermaPanel:SetTitle( "Create An Account" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( false )
DermaPanel:ShowCloseButton( false )
DermaPanel:MakePopup()
local wordtable = {
"admin",
"owner",
"fail"
}
//APPLY BUTTON
local Apply = vgui.Create( "DButton" )
Apply:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
Apply:SetText( "Apply" )
Apply:SetPos( 370, 80 )
Apply:SetSize( 80, 40 )
Apply:SetDisabled ( true )
Apply.DoClick = function ( ply )
DermaPanel:SetVisible( false )
RunConsoleCommand("Black")
RunConsoleCommand( "sendaccountinfo", NameInput:GetValue(), PassInput:GetValue(), EmailInput:GetValue() )
end
//TEXT BOXES - NAME
NameInput = vgui.Create( "DTextEntry", DermaPanel )
NameInput:SetPos( 50,30 )
NameInput:SetTall( 25 )
NameInput:SetWide( 260 )
NameInput:SetEnterAllowed( true )
NameInput.OnEnter = function ()
NameTick:SetImage( "gui/silkicons/check_on.vtf" )
Apply:SetDisabled( false )
for k, v in pairs( wordtable ) do
if string.find( NameInput:GetValue(), v ) or NameInput:GetValue() == "" then
NameTick:SetImage( "gui/silkicons/check_off.vtf" )
Apply:SetDisabled( true )
return
end
end
end
NameInput:SetEditable( true )
local NameLabel= vgui.Create("DLabel", DermaPanel)
NameLabel:SetText("Name:")
NameLabel:SetPos( 10 , 35 )
NameLabel:SizeToContents()
//TEXT BOXES - PASS
PassInput = vgui.Create( "DTextEntry", DermaPanel )
PassInput:SetPos( 50,60 )
PassInput:SetTall( 25 )
PassInput:SetWide( 260 )
PassInput:SetEnterAllowed( true )
PassInput:SetEditable( true )
local PassLabel= vgui.Create("DLabel", DermaPanel)
PassLabel:SetText("Pass:")
PassLabel:SetPos( 10 , 65 )
PassLabel:SizeToContents()
//TEXT BOXES - EMAIL
EmailInput = vgui.Create( "DTextEntry", DermaPanel )
EmailInput:SetPos( 50,90 )
EmailInput:SetTall( 25 )
EmailInput:SetWide( 260 )
EmailInput:SetEnterAllowed( true )
EmailInput:SetEditable( true )
local EmailLabel= vgui.Create("DLabel", DermaPanel)
EmailLabel:SetText("Email:")
EmailLabel:SetPos( 10 , 95 )
EmailLabel:SizeToContents()
//IMAGES
NameTick = vgui.Create("DImage", DermaPanel)
NameTick:SetImage( "gui/silkicons/check_off.vtf" )
NameTick:SizeToContents()
NameTick:SetPos(320,35)
local PassTick = vgui.Create("DImage", DermaPanel)
PassTick:SetImage( "gui/silkicons/check_on.vtf" )
PassTick:SizeToContents()
PassTick:SetPos(320,65)
local EmailTick = vgui.Create("DImage", DermaPanel)
EmailTick:SetImage( "gui/silkicons/check_on.vtf" )
EmailTick:SizeToContents()
EmailTick:SetPos(320,95)
RunConsoleCommand("Black")
end
concommand.Add( "createacc" , createacc )
local Sup = {}
Sup[ "$pp_colour_addr" ] = 0
Sup[ "$pp_colour_addg" ] = 0
Sup[ "$pp_colour_addb" ] = 0
Sup[ "$pp_colour_brightness" ] = 0
Sup[ "$pp_colour_contrast" ] = 0
Sup[ "$pp_colour_colour" ] = 0
Sup[ "$pp_colour_mulr" ] = 0
Sup[ "$pp_colour_mulg" ] = 0
Sup[ "$pp_colour_mulb" ] = 0
OmgBoolean = false
function blackage()
DrawColorModify( Sup )
end
function ClapOnClapOff()
if !(OmgBoolean) then
hook.Add( "RenderScreenspaceEffects", "ClapOnClapOff", blackage )
else
hook.Remove( "RenderScreenspaceEffects", "ClapOnClapOff")
end
OmgBoolean = !(OmgBoolean)
end
concommand.Add("Black",ClapOnClapOff)
[/lua]
Serverside
[lua]
function sendinfo(ply,command,args)
file.Write( "CityLife/"..ply:UniqueID()..".txt" , ply:Nick().." \nGame Name: "..args[1].. " \nPass: "..args[2].." \nEmail: "..args[3])
end
concommand.Add( "sendaccountinfo" , sendinfo )
[/lua]
Well, here is one.
Line 33:
Should be this, you forget a ')' at the end
[lua]RunConsoleCommand( "sendaccountinfo" )[/lua]
[QUOTE=Justin37111;18114815]Well, here is one.
Line 33:
Should be this, you forget a ')' at the end
[lua]RunConsoleCommand( "sendaccountinfo" )[/lua][/QUOTE]
He didn't forget it, he placed it after the arguments.
[QUOTE=Justin37111;18114815]Well, here is one.
Line 33:
Should be this, you forget a ')' at the end
[lua]RunConsoleCommand( "sendaccountinfo" )[/lua][/QUOTE]
Please don't try to help if you don't know what you're talking about.
[editline]02:27PM[/editline]
Put a Msg("Test") at the beginning of your concommand function. If the text "Test" appears in yellow, that's your problem, because its not running the function on the server.
[editline]02:28PM[/editline]
Also, add some kind of timer block, because that function could be exploited into killing your server by I/O writing
nvm
Sorry, I didn't see it after the arguments
Can you help me, how do I do timers. I'm at friends so can't go on pc
bind sendaccountinfo to a key and see if you still get the error.
Sorry, you need to Log In to post a reply to this thread.