This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Signas_Valentine's profile picture

Making an automated Player Database for a server

Started by Signas_Valentine, 03 March 2015 - 06:29 PM
Signas_Valentine #1
Posted 03 March 2015 - 07:29 PM
I have been trying to learn the LUA used by ComputerCraft for about a week now. Currently i have most of the basics down.
I am a Moderator for a new server and i have been tasked with Building, Programming, and designing most structures in the server.

Currently i have programmed and equipped basic single user login startup programs for the server, multi setting door locks, just basic programs with minimal complexity. Since i have finished the Library for the server the Admins gave me the task of making a Program that detects new playerson the server and then adds their name to a database automaticly. I have access to the locked spawn chunks so i don't need to worry about the shutdown when leaving the chunk.

I have been trying to learn to create a Table to use as the base for the database but i dont have enough skill for it at the moment.
Not to mention the other, more complex items required for the program.

If there is someone out there who can help me with a tutorial or a pastebin link or anything at all it would be an immense help.

I don't have much experience with ComputerCraft so most of the extremely complex programming setups will confuse me for a while.

Thank you for your time,
Signas V.
valithor #2
Posted 03 March 2015 - 08:20 PM
The biggest problem you will face when trying to do this is actually getting the names of the new players. In default Computercraft there is no way to get a list of players, or seeing if they are new to the server. If you are running the newest version, which has command computers to it might be possible using the list command. If this is not a problem, then I would suggest using a table, which you can then serialize and write to a file. Unfortunately I am on a computer, that I can not hit enter without it messing up, so I can not post any code right now.
Bomb Bloke #3
Posted 03 March 2015 - 11:55 PM
MineCraft's "list" command was introduced by 1.8. Current versions of ComputerCraft are for 1.7.10 and so don't have access to it.

The admin ChatBox from MoarPeripherals may be able to detect user login events. I'm not certain.

Another option would be to build a sensor from eg OpenCCSensors at spawn, which should be sufficient to pick up on all new players.

However you go about it, if ComputerCraft is involved, you'll want to read up on peripherals.
valithor #4
Posted 04 March 2015 - 01:19 AM
MineCraft's "list" command was introduced by 1.8. Current versions of ComputerCraft are for 1.7.10 and so don't have access to it.

The admin ChatBox from MoarPeripherals may be able to detect user login events. I'm not certain.

Another option would be to build a sensor from eg OpenCCSensors at spawn, which should be sufficient to pick up on all new players.

However you go about it, if ComputerCraft is involved, you'll want to read up on peripherals.

I am pretty sure the moarperipherals chat boxes can not, so his best bet is OpenCCSensors.
edit
Or even a player detector (dont know which mod probably moar peripherals).
edit2
I believe there is a testfor command, which would see if that player is online. You could use the @a tag in the commandcomp, and read the string/strings it returns. I have not tested this though
Edited on 04 March 2015 - 12:23 AM
Signas_Valentine #5
Posted 06 March 2015 - 02:57 PM
So far these are great! For an extra mod to be used i'll have to get the server owner to add it in. Shouldn't be a problem though. As for the command computers, i have not seen them in the NEI invintory so i doubt they'd be useful until we update to a version where they are there. Peripherials will definately help me understand the basics for using different connective items, and the OpenCCSensors would be useful reguardless of current task. Seeing as how it's an addon mod then I'll just let the owner know how important it is. Overall, very informative and helpful, hopefully someone will come along who can help with the full coding of the programs, thanks for the advice too, should be easier now for most everything.