• LUA coder, i would like your help :D
    6 replies, posted
need a LUA file thats starts up a command when the game is started. the command: God 1... ( command that starts automatically when the game is started ) its a very simple thing indeed. so i guess its no match :D the reason of this simple task is that a friend of mine would like something good to practice on ( me as well :P ) just to do some research on how LUA files are builded and how they behave... Help a simple researcher out please :P thank you. [highlight](User was banned for this post ("Undescriptive thread title" - mahalis))[/highlight]
[lua]hook.Add("InitPostEntity" , "StartUp" , function() game.ConsoleCommand("sv_godmode 1 \n") game.ConsoleCommand("sbox_plpldmg 1 \n") end )[/lua]
[lua] function GM:Autorun(ply) if ply:IsAdmin() then ply:SetHealth( 500 ) ply:ConCommand( "sv_cheats", "1" ) ply:ConCommand( "notarget" ) end end [/lua]
[QUOTE=Ronon Dex;17105419][lua] function GM:Autorun(ply) if ply:IsAdmin() then ply:SetHealth( 500 ) ply:ConCommand( "sv_cheats", "1" ) ply:ConCommand( "notarget" ) end end [/lua][/QUOTE] Are you an idiot? 1) Autorun is not a valid function 2) Since it's not a valid function, the arg (ply) will not be valid 3) Running sv_cheats on the client won't work. 4) You didn't tab your code Please, if you don't know what you're talking about, don't post. People learning false techniques like that will make it [b]so much harder[/b] for them.
[QUOTE=Ronon Dex;17105419][lua] function GM:Autorun(ply) if ply:IsAdmin() then ply:SetHealth( 500 ) ply:ConCommand( "sv_cheats", "1" ) ply:ConCommand( "notarget" ) end end [/lua][/QUOTE] You do realise that wouldn't do anything, right? [editline]07:07PM[/editline] Fucking ninjas.
I placed the code file hook.Add("InitPostEntity" , "StartUp" , function() game.ConsoleCommand("sv_godmode 1 \n") game.ConsoleCommand("sbox_plpldmg 1 \n") end ) into LUA/autorun But when the game session is started i get this message: Lua initialized (Lua 5.1) LuaGetfile: Not Loading autorun/Startup_commands.LUA Couldn't include file 'autorun/Startup_commands.LUA' (File not found) any suggestions? :P
Lua should never be LUA. When you write it's name, it's Lua, and when you put it as a file/folder name, it's lua. Change your filename to startup_commands.lua.
Sorry, you need to Log In to post a reply to this thread.