We need these.

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

We need these.

by Tedypig » Sat Mar 16, 2013 20:53

/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.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Mar 16, 2013 20:58

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!
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Sat Mar 16, 2013 21:11

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.
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Sat Mar 16, 2013 21:12

/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.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Sat Mar 16, 2013 21:19

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
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Sat Mar 16, 2013 21:41

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]
 

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Sun Mar 17, 2013 00:29

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.
Last edited by Tedypig on Sun Mar 17, 2013 00:36, edited 1 time in total.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Sun Mar 17, 2013 00:38

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
})
Last edited by Traxie21 on Sun Mar 17, 2013 00:39, edited 1 time in total.
 

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Sun Mar 17, 2013 00:56

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.
Last edited by Tedypig on Sun Mar 17, 2013 00:57, edited 1 time in total.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Sun Mar 17, 2013 01:30

you need two = signs in an if statement. if param == nil then ...
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Sun Mar 17, 2013 01:49

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.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Sun Mar 17, 2013 02:31

Oh boy, thats going to be quite a task for you if you have never done it before....
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Sun Mar 17, 2013 02:32

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).
Last edited by prestidigitator on Sun Mar 17, 2013 02:34, edited 1 time in total.
 

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Sun Mar 17, 2013 04:29

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.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Sun Mar 17, 2013 09:06

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!
 

User avatar
Tedypig
Member
 
Posts: 284
Joined: Tue Mar 05, 2013 12:33
IRC: Piggybear87
In-game: Piggybear

by Tedypig » Mon Mar 18, 2013 11:26

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.
01010100 01100101 01100100 01111001 01110000 01101001 01100111
 

User avatar
YoYoBuddy
Member
 
Posts: 247
Joined: Sun Jan 27, 2013 00:49

by YoYoBuddy » Thu Mar 21, 2013 20:30

Yeah we do need these teddypig
“People are more difficult to work with than machines. And when you break a
person, he can't be fixed."

-Rick Riordan
 


Return to Minetest General

Who is online

Users browsing this forum: Bing [Bot] and 15 guests