• LuaServer
    467 replies, posted
[release] [h2]LuaServer[/h2] [b]A Minecraft SMP Mod[/b] Hey there people of Facepunch! Do you love using Lua to control Gmod? Do you like playing Minecraft? If so then this mod for the minecraft server software is just what your looking for. :) I have made a mod that integrates the Lua scripting language into the vanilla minecraft server. :dance: [h2]Links[/h2] The website for the LuaServer is here at: [URL="http://luaserver.org"]LuaServer.org[/URL] The website has a forum, a wiki and a pretty front page. :P The quick link for the download of LuaServer is here: [URL="http://downloads.luaserver.org/zero/LuaServer.jar"]Download[/URL] [h2]Notes[/h2] Suggestions for improvement are always welcome! If you think something is needed, tell me! Otherwise I cant know that it is needed. If you would like to help out in a coding way, tell me so. If you want to help out but don't know how to code? Donate. :) [/release]
[lua]function OnPlayerItemPickup(Item) Item:GetPlayer():SetOnFire() end[/lua] DON'T PICK UP ANYTHING! This is neat.
Oh god, think of the possibilities with this.
Beats trying to learn java right? :P
Only for server ?
Is this out of date? I'm getting: [code]Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: net.minecraft.server.MinecraftServer. Program will exit.[/code]
[QUOTE=techtuts0;30891640]Is this out of date? I'm getting: [code]Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: net.minecraft.server.MinecraftServer. Program will exit.[/code][/QUOTE] It looks like you havent installed it correctly. Make sure youve copied all the files across into their right places.
I FUCKING LOVE YOU, I'M GUSTAING ALL OVER MYSELF.
[QUOTE=Genesis999;30891707]It looks like you havent installed it correctly. Make sure youve copied all the files across into their right places.[/QUOTE] I've tried the latest minecraft_server.jar, that gives that error, but an outdated version of the .jar works
[QUOTE=techtuts0;30891864]I've tried the latest minecraft_server.jar, that gives that error, but an outdated version of the .jar works[/QUOTE] Oh! Your right. Its only for 1.6.6 until the program i use to decompile/recompile is updated for 1.7
When will that be? D:
Lua...Minecraft? I am literally speechless.
[QUOTE=jrj996;30891897]When will that be? D:[/QUOTE] I wish i knew. I really do. I so want to play with pistons. Every time im in the folder im clicking update but they havent released it yet. :(
okay got a few questions; How can we assign custom variables to players Can we create tables fine with no problem and do k,v loops and such (reason I ask I've only done GLua and nothing outside of it D:) How can I create arguments inside of onplayerchat and such like if it finds the string "/sethealth 100" and does 100 health (aka how to I get the players arguments)
[QUOTE=jrj996;30891990]okay got a few questions; How can we assign custom variables to players Can we create tables fine with no problem and do k,v loops and such (reason I ask I've only done GLua and nothing outside of it D:) How can I create arguments inside of onplayerchat and such like if it finds the string "/sethealth 100" and does 100 health (aka how to I get the players arguments)[/QUOTE] Probably the best way to assign custom variables is setup an SQL table that contains information on each player. tables and k, v loops should work normally. Commands are handled in the CommandHandler function. If you head over to the wiki you can see some simple examples and the structure of the different objects.
-snip- Read the wiki, didn't realize commands were called through chat, <3 I really do appreciate this addon in all seriousness, you're awesome!
This is the best thing ever. Expect awesome gamemodes soon :v:
Can you add distance functions soon? Similar to GLua's, basically you can check a vector, or whatever it is in MC and have it do something like [lua] Vector(0,0,0):Distance(player:GetPos()) [/lua] Something that has a similiar use would be VERY useful for out of bounds areas and such. Toying around now; [lua] function CommandHandler(Command,Player) -- Defining what commands do. if Command:GetCommand() == "/sethealth" or "/SetHP" && Command:GetUser():IsOp() then if Command:GetArgument(1) && Command:GetArgument(2) then local Target = GetPlayerEntity(Command:GetArgument(1)) if Target:IsAlive() then Target:AddHealth(Command:GetArgument(2)) PrintToChat("You've been given "..Command:GetArgument(2).." HP by "..Command:GetUser(),Command:GetArgument(1),2) end end end if Command:GetCommand() == "/notifyall" && Command:GetUser():IsOp() && Command:GetArgument(1) then PrintToChat("[Admin Notify]: "..Command:GetArgument,"#all",2) end end [/lua] :buddy:
Now all we need is an [i]Explosion(pos, strength)[/i] function and then the fun can begin :v:
Oh, I can probably do that, if you use the SetOnFire command you can get the players position or just a position for that matter. and do a radius of blocks around the player, now we gotta wait for him to recompile it. :smith: Oh well shit seems theres already a explosion function, [lua] CreateExplosion(rawentity,x,y,z,size) [/lua]
Time to learn and try this out!
Genius.
[QUOTE=jrj996;30892722] Oh well shit seems theres already a explosion function, [lua] CreateExplosion(rawentity,x,y,z,size) [/lua][/QUOTE] YES! [lua] for i = 0, 100 do for j = 0, 100 do CreateExplosion(stuff, i, 64, j, 100) end end[/lua] Here we go :v:
Oh god, this is damn awesome.
We need that update, for the love of god! D: Some moar fun [lua] local it = {} it[1] = "stone",it[2] = "grass" it[3] = "dirt",it[4] = "cobblestone","cobble" it[5] = "woodplank",it[6] = "sappling" it[7] = "bedrock",it[8] = "water" it[9] = "statwater",it[10] = "lava" it[11] = "statwater",it[12] = "sand" it[13] = "gravel",it[14] = "goldore" it[15] = "ironore",it[16] = "coalore" it[17] = "wood",it[18] = "leaves" it[19] = "sponge",it[20] = "glass" it[21] = "lapisore",it[22] = "lapisblock" it[23] = "dispenser",it[24] = "sandstone" it[25] = "noteblock",it[26] = "bed" it[27] = "powerrail",it[28] = "detectrail" it[29] = "stickypiston",it[30] = "cobweb" it[31] = "tallgrass",it[32] = "deadshrub" it[33] = "piston",it[34] = "pistext" it[35] = "wool",it[37] = "dandelion" if cmd:GetCommand() == "/trade" then if !cmd:GetArgument(1) or !cmd:GetArgument(2) then PrintToChat("You need to fill out the command like this: /trade <playernamehere> <itemidhere>",cmd:GetUser(),2) else if Target:IsAlive() then if cmd:GetUser():HasItem(cmd:GetArgument(2)) then Target:AddItem(cmd:GetArgument(2),1) cmd:GetUser():RemoveItem(cmd:GetArgument(2),1) end end end end if cmd:GetCommand() == "/i" or "/itemme" && cmd:player():IsOp() then for k,v in pairs(it) do if cmd:GetArgument(1) == v then player:AddItem(k,cmd:GetArgument(2)) end end end end [/lua] That loop at the end is untested :3
[QUOTE=jrj996;30892301]Can you add distance functions soon? Similar to GLua's, basically you can check a vector, or whatever it is in MC and have it do something like [lua] Vector(0,0,0):Distance(player:GetPos()) [/lua] Something that has a similiar use would be VERY useful for out of bounds areas and such. Toying around now; [lua] function CommandHandler(Command,Player) -- Defining what commands do. if Command:GetCommand() == "/sethealth" or "/SetHP" && Command:GetUser():IsOp() then if Command:GetArgument(1) && Command:GetArgument(2) then local Target = GetPlayerEntity(Command:GetArgument(1)) if Target:IsAlive() then Target:AddHealth(Command:GetArgument(2)) PrintToChat("You've been given "..Command:GetArgument(2).." HP by "..Command:GetUser(),Command:GetArgument(1),2) end end end if Command:GetCommand() == "/notifyall" && Command:GetUser():IsOp() && Command:GetArgument(1) then PrintToChat("[Admin Notify]: "..Command:GetArgument,"#all",2) end end [/lua] :buddy:[/QUOTE] Ive next to no experience with Glua so ive no idea what its like. But i can add said things into the update list. And as to your script... The only thing i noticed is your calling Command:GetUser():IsOp() .. but the GetUser() function only returns a string. The way i usually do it is at the top of the command handler function is add a: local Player = GetPlayerEntity(Command:GetUser()) And then use it like Player:IsOp() And also your doing checks on whether the Command:GetArgument() calls are nil or not but with the current version they return a string "#nil" if theyre not used. Ill change that in the next version.
Hmmk, by any chance is that next version going to be when you can compile 1.7? Because the nil string may be a problem..
[QUOTE=jrj996;30902314]Hmmk, by any chance is that next version going to be when you can compile 1.7? Because the nil string may be a problem..[/QUOTE] Uploaded a new version. Fixes that issue and adds some small things. Still not 1.7 :(
No problem dude, the fact that you made this makes me very happy, like a lot dude. I'm sick of bukkit and shit I wanna do things my way. Also, considering you know java how did people create dummy mobs, like npc's that did nothing? [editline]5th July 2011[/editline] Another question, do WorldClass functions have to be called by anything or I can just do shit like GetTime() by itself?
[QUOTE=jrj996;30906895]No problem dude, the fact that you made this makes me very happy, like a lot dude. I'm sick of bukkit and shit I wanna do things my way. Also, considering you know java how did people create dummy mobs, like npc's that did nothing? [editline]5th July 2011[/editline] Another question, do WorldClass functions have to be called by anything or I can just do shit like GetTime() by itself?[/QUOTE] To call functions in the WorldClass you need to have made a world object using GetWorld() and access them through that.
Sorry, you need to Log In to post a reply to this thread.