1. Post #1

    July 2011
    144 Posts
    [release]
    [h2]LuaServer[/h2]
    A Minecraft SMP Mod

    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.

    [h2]Links[/h2]
    The website for the LuaServer is here at: LuaServer.org

    The website has a forum, a wiki and a pretty front page. :P

    The quick link for the download of LuaServer is here: Download

    [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]
    Reply With Quote Edit / Delete Reply Windows 7 Australia Show Events Winner x 48Useful x 6Dumb x 3Zing x 1Disagree x 1Funny x 1 (list)

  2. Post #2
    moo
    CowThing's Avatar
    November 2006
    4,782 Posts
    function OnPlayerItemPickup(Item)
        Item:GetPlayer():SetOnFire()
    end

    DON'T PICK UP ANYTHING!

    This is neat.
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Funny Funny x 66Agree Agree x 1 (list)

  3. Post #3
    Gold Member
    jetboy's Avatar
    January 2009
    2,258 Posts
    Oh god, think of the possibilities with this.
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Agree Agree x 10Dumb Dumb x 1 (list)

  4. Post #4

    February 2009
    466 Posts
    Beats trying to learn java right? :P
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 38Disagree Disagree x 4Zing Zing x 2 (list)

  5. Post #5
    aurum481's Avatar
    November 2008
    2,420 Posts
    Only for server ?
    Reply With Quote Edit / Delete Reply Windows XP Lithuania Show Events Agree Agree x 2 (list)

  6. Post #6
    Gold Member
    techtuts0's Avatar
    December 2009
    312 Posts
    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.

  7. Post #7

    July 2011
    144 Posts
    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.
    It looks like you havent installed it correctly. Make sure youve copied all the files across into their right places.
    Reply With Quote Edit / Delete Reply Windows 7 Australia Show Events Agree Agree x 3Disagree Disagree x 1 (list)

  8. Post #8
    jrj996's Avatar
    July 2009
    1,656 Posts
    I FUCKING LOVE YOU, I'M GUSTAING ALL OVER MYSELF.
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Funny Funny x 16Optimistic Optimistic x 2Dumb Dumb x 1 (list)

  9. Post #9
    Gold Member
    techtuts0's Avatar
    December 2009
    312 Posts
    It looks like you havent installed it correctly. Make sure youve copied all the files across into their right places.
    I've tried the latest minecraft_server.jar, that gives that error, but an outdated version of the .jar works
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Informative Informative x 1Agree Agree x 1 (list)

  10. Post #10

    July 2011
    144 Posts
    I've tried the latest minecraft_server.jar, that gives that error, but an outdated version of the .jar works
    Oh! Your right. Its only for 1.6.6 until the program i use to decompile/recompile is updated for 1.7

  11. Post #11
    jrj996's Avatar
    July 2009
    1,656 Posts
    When will that be? D:

  12. Post #12
    TheGronk's Avatar
    April 2011
    1,045 Posts
    Lua...Minecraft? I am literally speechless.
    Reply With Quote Edit / Delete Reply Windows Vista Australia Show Events Agree Agree x 22 (list)

  13. Post #13

    July 2011
    144 Posts
    When will that be? D:
    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. :(

  14. Post #14
    jrj996's Avatar
    July 2009
    1,656 Posts
    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)

  15. Post #15

    July 2011
    144 Posts
    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)
    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.

  16. Post #16
    jrj996's Avatar
    July 2009
    1,656 Posts
    -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!

  17. Post #17
    Gold Member

    October 2008
    3,838 Posts
    This is the best thing ever. Expect awesome gamemodes soon
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Winner Winner x 6Agree Agree x 1 (list)

  18. Post #18
    jrj996's Avatar
    July 2009
    1,656 Posts
    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
    Vector(0,0,0):Distance(player:GetPos())
    
    Something that has a similiar use would be VERY useful for out of bounds areas and such.

    Toying around now;
    
    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
    
    :buddy:
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Winner Winner x 5 (list)

  19. Post #19
    Gold Member

    October 2008
    3,838 Posts
    Now all we need is an Explosion(pos, strength) function and then the fun can begin
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 8 (list)

  20. Post #20
    jrj996's Avatar
    July 2009
    1,656 Posts
    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,
       CreateExplosion(rawentity,x,y,z,size) 
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Winner Winner x 1 (list)

  21. Post #21
    vandooz's Avatar
    June 2010
    207 Posts
    Time to learn and try this out!

  22. Post #22
    murphy7's Avatar
    February 2009
    693 Posts
    Genius.

  23. Post #23
    Gold Member

    October 2008
    3,838 Posts
    Oh well shit seems theres already a explosion function,
       CreateExplosion(rawentity,x,y,z,size) 
    YES!
    for i = 0, 100 do
      for j = 0, 100 do
        CreateExplosion(stuff, i, 64, j, 100)
      end
    end
    Here we go
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Funny Funny x 22 (list)

  24. Post #24
    Slaaf van EternalFlamez.Ik wilde heel graag de laatste Indie Bundle, en ik kreeg deze kuttitel er gratis bij.
    Staneh's Avatar
    March 2010
    4,059 Posts
    Oh god, this is damn awesome.
    Reply With Quote Edit / Delete Reply Windows XP Netherlands Show Events Agree Agree x 2 (list)

  25. Post #25
    jrj996's Avatar
    July 2009
    1,656 Posts
    We need that update, for the love of god! D:

    Some moar fun
             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
    
    That loop at the end is untested :3

  26. Post #26

    July 2011
    144 Posts
    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
    Vector(0,0,0):Distance(player:GetPos())
    
    Something that has a similiar use would be VERY useful for out of bounds areas and such.

    Toying around now;
    
    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
    
    :buddy:
    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.

  27. Post #27
    jrj996's Avatar
    July 2009
    1,656 Posts
    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..
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Disagree Disagree x 1 (list)

  28. Post #28

    July 2011
    144 Posts
    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..
    Uploaded a new version. Fixes that issue and adds some small things. Still not 1.7 :(

  29. Post #29
    jrj996's Avatar
    July 2009
    1,656 Posts
    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?

    Edited:

    Another question, do WorldClass functions have to be called by anything or I can just do shit like GetTime() by itself?

  30. Post #30

    July 2011
    144 Posts
    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?

    Edited:

    Another question, do WorldClass functions have to be called by anything or I can just do shit like GetTime() by itself?
    To call functions in the WorldClass you need to have made a world object using GetWorld() and access them through that.

  31. Post #31
    jrj996's Avatar
    July 2009
    1,656 Posts
    I'm a bit confused, can you create an example? :S

  32. Post #32

    July 2011
    144 Posts
    I'm a bit confused, can you create an example? :S
    function CommandHandler(Command)
    if Command:GetCommand() == "/daytime" then
    local World = GetWorld(0)
    World:SetTime(0) -- The parameter is the time you want... goes from 0 to 24000
    end
    end

  33. Post #33
    jrj996's Avatar
    July 2009
    1,656 Posts
    Ah, okay, thanks!

  34. Post #34
    Eeshton's Avatar
    October 2010
    10,385 Posts
    Makes me want to learn Lua, but I'm too lazy and I hate coding :V
    Reply With Quote Edit / Delete Reply Windows Vista Anonymous Proxy Show Events Agree Agree x 7Disagree Disagree x 3 (list)

  35. Post #35
    I LIKE BIG DUCKS AND I CANNOT LIE, YOU OTHER QUACKS CAN'T DENY
    Wootman's Avatar
    December 2008
    13,320 Posts
    I hope this is better then shitty Bukkit
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 3Disagree Disagree x 2 (list)

  36. Post #36
    jrj996's Avatar
    July 2009
    1,656 Posts
    Makes me want to learn Lua, but I'm too lazy and I hate coding :V
    You should learn, it's really easy and fun once you see your stuff in action. Once everything is compiled I think I might do a series of tutorials on this :3:
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Agree Agree x 2Friendly Friendly x 1 (list)

  37. Post #37
    Please waste more of your money changing this title again.
    Gmod4ever's Avatar
    August 2005
    6,739 Posts
    This looks neat.

    I will definitely look into this once it's updated to the current version of Minecraft.

    :buddy:
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1 (list)

  38. Post #38
    moo
    CowThing's Avatar
    November 2006
    4,782 Posts
    Makes me want to learn Lua, but I'm too lazy and I hate coding :V
    Lua is probably one of the easiest scripting languages out there!
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 11Disagree Disagree x 1 (list)

  39. Post #39
    vandooz's Avatar
    June 2010
    207 Posts
    Lua is probably one of the easiest scripting languages out there!
    And PAWN, but Lua is more used by games and mods.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Disagree Disagree x 1 (list)

  40. Post #40
    Saccn's Avatar
    December 2009
    205 Posts
    This is awesome. This could become the next bukkit, if it keeps getting updated.
    Reply With Quote Edit / Delete Reply Windows 7 Latvia Show Events Agree Agree x 3 (list)