I really don't think this is worthy of a thread but the "What do you need help with" thread has been locked.
Here is my code:
[code]
function dump()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end
timer.create(timer1, 30, 5, dump())
[/code]
Here is the error I'm getting
[code]
[lua\autorun\client\cdump.lua:7] ')' expected (to close '(' at line 6) near 'end'
[/code]
Can someone please explain to me why I'm getting this error?!?!
Try [lua]timer.create("timer1", 30, 5, dump())[/lua]
unless timer1 is a variable
[QUOTE=Jeremy368;30244565]I really don't think this is worthy of a thread but the "What do you need help with" thread has been locked.
Here is my code:
[code]
function dump()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end
timer.create(timer1, 30, 5, dump())
[/code]
Here is the error I'm getting
[code]
[lua\autorun\client\cdump.lua:7] ')' expected (to close '(' at line 6) near 'end'
[/code]
Can someone please explain to me why I'm getting this error?!?![/QUOTE]
Simply do.
[lua]timer.Create("ConDump", 30, 5, function()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end)[/lua]
[lua]
function dump()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end
timer.create("timer1", 30, 5, dump)
[/lua]
[QUOTE=RTM xBEASTx;30244865]Simply do.
[lua]timer.Create("ConDump", 30, 5, function()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end)[/lua][/QUOTE]
This works however it causes significantly lag. Any explanation as to why this occurs?
[editline]4th June 2011[/editline]
[QUOTE=sniperlover;30245141][lua]
function dump()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end
timer.create("timer1", 30, 5, dump)
[/lua][/QUOTE]
This returns this error:
[lua\autorun\client\cdump.lua:11] attempt to call field 'create' (a nil value)
[editline]4th June 2011[/editline]
[QUOTE=sweeneypaul;30244829]Try [lua]timer.create("timer1", 30, 5, dump())[/lua]
unless timer1 is a variable[/QUOTE]
This is the error I get:
Log of console has been dumped in steam/steamapps/your_account_name/garrysmod
RunConsoleCommand blocked - sent before player spawned (condump)
[lua\autorun\client\cdump.lua:11] attempt to call field 'create' (a nil value)
[QUOTE=Jeremy368;30245524]This works however it causes significantly lag. Any explanation as to why this occurs?
[editline]4th June 2011[/editline]
This returns this error:
[lua\autorun\client\cdump.lua:11] attempt to call field 'create' (a nil value)[/QUOTE]
Lua is a case sensitive language so create is not the same as Create, use the wiki in future to find correct functions.
Also, i dont really know why that should be returning a laggy script, something that simple should theorticaly be doing nothing bad.
[QUOTE=RTM xBEASTx;30245673]Lua is a case sensitive language so create is not the same as Create, use the wiki in future to find correct functions.
Also, i dont really know why that should be returning a laggy script, something that simple should theorticaly be doing nothing bad.[/QUOTE]
Yes, I 100% agree. As for the case sensitiveness of the language, I realized that after I started at the wiki page for "timer.Create"
[editline]4th June 2011[/editline]
Now I'm having this problem...
RunConsoleCommand blocked - sent before player spawned (condump)
[editline]4th June 2011[/editline]
I tried something like this
[code]
if ply:spawn == true then
//timer.Create("timer1", 30, 5, dump())
MsgN( "SWEEEEEET" )
elseif ply:spawn == false
MsgN( "BULLSHI-" )
end
[/code]
But I got some error
[lua\autorun\client\cdump.lua:12] function arguments expected near '=='
ply.spawn instead?
[QUOTE=Jeremy368;30245732]Yes, I 100% agree. As for the case sensitiveness of the language, I realized that after I started at the wiki page for "timer.Create"
[editline]4th June 2011[/editline]
Now I'm having this problem...
RunConsoleCommand blocked - sent before player spawned (condump)
[editline]4th June 2011[/editline]
I tried something like this
[code]
if ply:spawn == true then
//timer.Create("timer1", 30, 5, dump())
MsgN( "SWEEEEEET" )
elseif ply:spawn == false
MsgN( "BULLSHI-" )
end
[/code]
But I got some error
[lua\autorun\client\cdump.lua:12] function arguments expected near '=='[/QUOTE]
Give me the full script and what you want doing and ill take a shot at it.
So the problem I'm currently having is that the con command is trying to execute before the player is spawned (which is for some reason, a problem)
So I'm trying to run a check to see if the player is spawned or not.
[code]
function dump()
MsgN( "Log of console has been dumped in steam/steamapps/your_account_name/garrysmod" )
RunConsoleCommand( "condump" )
MsgN( "" )
end
if ply:spawn == true then
//timer.Create("timer1", 30, 5, dump())
MsgN( "SWEEEEEET" )
elseif ply:spawn == false
MsgN( "BULLSHIT" )
end
[/code]
[lua]hook.Add("PlayerInitialSpawn", function(ply)
ply.HasSpawned = true
end)
local meta = FindMetaTable("Player")
function meta:HasSpawned()
return self.HasSpawned
end
--Useage: ply:HasSpawned returns yes if true and no if not.
[/lua]
Sorry, you need to Log In to post a reply to this thread.