Page 1 of 1

We need these.

PostPosted: Sat Mar 16, 2013 20:53
by Tedypig
/setspawn - Sets the default spawn location.
/setmyspawn - Sets your spawn location.
/title <player> [title] - Sets <player>s [title].
/kick <player> - Kicks <player>.
/motd - Sets the message of the day.
/onjoin <message> - Says <message> when you log in.
/onleave <message> - Says <message> when you log off.
/jail <player> - Sends <player> to jail.
/unjail <player> - Releases <player> from jail.
/setjail <x,y,x/blank for current location> - Sets where the jail is.


Only a few of the commands we should have in Minetest. Yes, some are inspired by MineCraft, but I really would like to have them.

PostPosted: Sat Mar 16, 2013 20:58
by PilzAdam
Tedypig wrote:/setspawn - Sets the default spawn location.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set static_spawn x,y,z

Tedypig wrote:/motd - Sets the message of the day.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set motd Awesome message!

PostPosted: Sat Mar 16, 2013 21:11
by prestidigitator
Not sure about the jail ones. They'd probably have to be combined with permissions somehow, like removing the "interact" permission any time you send someone "to jail". Probably better as a mod than a builtin game feature.

PostPosted: Sat Mar 16, 2013 21:12
by rarkenin
/jail <player> - Sends <player> to jail.
/unjail <player> - Releases <player> from jail.
/setjail <x,y,x/blank for current location> - Sets where the jail is.


Can be implemented by forcing binding of entities. Moving jail requires old and new locations are in a loaded chunk.

PostPosted: Sat Mar 16, 2013 21:19
by kaeza
rarkenin wrote:
/jail <player> - Sends <player> to jail.
/unjail <player> - Releases <player> from jail.
/setjail <x,y,x/blank for current location> - Sets where the jail is.


Can be implemented by forcing binding of entities. Moving jail requires old and new locations are in a loaded chunk.

This may come in handy: http://forum.minetest.net/viewtopic.php?id=4383

PostPosted: Sat Mar 16, 2013 21:41
by Traxie21
Setspawn is easy.

Jail could be avery easy to make.
motd exists
Visible titles are impossible ATM, Ut my ranks system is something like this.
onjoin and onleave may be possible, but may not.

Sorry for my bad typing, my left thumb is blistered and my hands are raw. [yard work day]

PostPosted: Sun Mar 17, 2013 00:29
by Tedypig
For /onjoin am I heading in the right direction?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

minetest.register_chatcommand ("onjoin", {
    params = "<message>",
    description = "Sets your Onjoin message",
    privs = {onjoin=true}
    func = function (name,param)
        minetest.chat_send_all ('<name> just set their onjoin message to "[message]"'),
        end
        if param = nil then
        return minetest.chat_send_player ('Invalid name'),
        end
        if param = true then
            minetes.register_on_joinplayer (function(player)
            )
           
})

I am new to coding and this is just what I get from the API tab on the homepage. Feedback?

EDIT: I realize I forgot the "t" in minetest. This is just to get some help guidelines.

PostPosted: Sun Mar 17, 2013 00:38
by Traxie21
Tedypig wrote:For /onjoin am I heading in the right direction?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

minetest.register_chatcommand ("onjoin", {
    params = "<message>",
    description = "Sets your Onjoin message",
    privs = {onjoin=true}
    func = function (name,param)
        minetest.chat_send_all ('<name> just set their onjoin message to "[message]"'),
        end
        if param = nil then
        return minetest.chat_send_player ('Invalid name'),
        end
        if param = true then
            minetes.register_on_joinplayer (function(player)
            )
           
})

I am new to coding and this is just what I get from the API tab on the homepage. Feedback?

Not bad!

Correcting:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all


minetest.register_chatcommand ("onjoin", {
    params = "<message>",
    description = "Sets your Onjoin message",
    privs = {onjoin=true},
    func = function(name, param)
        if param = nil then
        return minetest.chat_send_player ('Invalid name'),
        end
        if param ~= nil or param ~= "" then
        minetest.chat_send_all (name..' just set their onjoin message to '..param)
            minetest.register_on_joinplayer (function(player)
            --DOSTUFF--
            end)
         end
     end
})

PostPosted: Sun Mar 17, 2013 00:56
by Tedypig
Traxie21 wrote:
Tedypig wrote:For /onjoin am I heading in the right direction?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

minetest.register_chatcommand ("onjoin", {
    params = "<message>",
    description = "Sets your Onjoin message",
    privs = {onjoin=true}
    func = function (name,param)
        minetest.chat_send_all ('<name> just set their onjoin message to "[message]"'),
        end
        if param = nil then
        return minetest.chat_send_player ('Invalid name'),
        end
        if param = true then
            minetes.register_on_joinplayer (function(player)
            )
           
})

I am new to coding and this is just what I get from the API tab on the homepage. Feedback?

Not bad!

Correcting:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all


minetest.register_chatcommand ("onjoin", {
    params = "<message>",
    description = "Sets your Onjoin message",
    privs = {onjoin=true},
    func = function(name, param)
       [b] if param = nil then [/b]
        return minetest.chat_send_player ('Invalid name'),
        end
        if param ~= nil or param ~= "" then
        minetest.chat_send_all (name..' just set their onjoin message to '..param)
            minetest.register_on_joinplayer (function(player)
            --DOSTUFF--
            end)
         end
     end
})

It's saying something on line 6 is bad, I mad line 6 bold.

EDIT:Well I tried to anyway. lol.

PostPosted: Sun Mar 17, 2013 01:30
by VanessaE
you need two = signs in an if statement. if param == nil then ...

PostPosted: Sun Mar 17, 2013 01:49
by Tedypig
OK, thank you. I'm kinda stuck though. I don't know how to make it save, and what you see is as far as I can get right now. I guess I need to study more. Lol.

PostPosted: Sun Mar 17, 2013 02:31
by Traxie21
Oh boy, thats going to be quite a task for you if you have never done it before....

PostPosted: Sun Mar 17, 2013 02:32
by prestidigitator
To save/persist something for each player, you are probably going to have to save and load a file under the world directory. Not the easiest thing to do if you are new to Lua and mod writing, but a simple implementation can look look something like:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local SAVE_FILE_NAME = "player_onjoin.ser"

local function openSaveFile(mode)
   local worldDir = minetest.get_worldpath()
   local filePath = worldDir.."/"..SAVE_FILE_NAME
   return io.open(filePath, mode)
end

local function saveOnjoinData(data)
   local saveFile = openSaveFile("w+")

   -- Might be better as minetest.log() or something, so we don't crash the server
   assert(saveFile, "Could not write onjoin save file")

   saveFile:write(minetest.serialize(data))
   saveFile:flush()
   saveFile:close()
end

local function loadOnjoinData()
   local saveFile = openSaveFile("r")
   if not saveFile then return nil end
   local data = minetest.deserialize(saveFile:read("*a"))
   saveFile:close()
   return data
end


Where "data" is a table containing all data you'd like to save (e.g. a map from player name to join message string).

PostPosted: Sun Mar 17, 2013 04:29
by Tedypig
Traxie21 wrote:Oh boy, thats going to be quite a task for you if you have never done it before....

Well, what I got is pretty good (in my opinion) for only learning what I know in about a week. Think of where I will be in 2, in 3, in a year.... It will take some time, but I will learn. After that, who knows? I might take yalls place helping n00bs like me! :)

EDIT WITHOUT THE EDIT BUTTON:WOW I just read that and it sounds rude. I promise It wasn't.

Now for you prestidigitator, You are probably the most helpful person I have ever met (online OR in person). You have taken time out of your day and helped me with all my "mods" I think it's around three of them now. The world could learn a thing or two from you. Thank you, I really mean it.

PostPosted: Sun Mar 17, 2013 09:06
by 0gb.us
PilzAdam wrote:
Tedypig wrote:/setspawn - Sets the default spawn location.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set static_spawn x,y,z

Tedypig wrote:/motd - Sets the message of the day.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set motd Awesome message!


Yeah. I was going to say that too. Except you need need "-n".

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set -n static_spawn x,y,z

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/set -n motd Awesome message!

PostPosted: Mon Mar 18, 2013 11:26
by Tedypig
Could I instead, go to chatcommands.lua and find those commands and add "handle as /motd" and "handle as /setspawn"? That way It could be shorter and closer to what I wanted.

PostPosted: Thu Mar 21, 2013 20:30
by YoYoBuddy
Yeah we do need these teddypig