[Mod] Advanced Ranks [ranks]

Isja Krass
Member
Posts: 46
Joined: Sat Aug 18, 2018 19:30
In-game: init.lua
Location: {X=25.25, y=-400, z=478,8} Bavaria, Germany

Re: [Mod] Advanced Ranks [ranks]

by Isja Krass » Post

maybe you can add the feature, that the rank be display in the hud?

User avatar
Walker
Member
Posts: 1802
Joined: Tue Oct 03, 2017 09:22
In-game: Walker
Contact:

Re: [Mod] Advanced Ranks [ranks]

by Walker » Post

ranks crash the server if a offline player wrote a message ( like the admin-minetest-terminal )

Code: Select all

2019-06-14 07:22:02: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'ranks' in callback on_chat_message(): /media/sda3/Minetest/server4/.minetest/mods/ranks/init.lua:59: attempt to index local 'player' (a nil value)
2019-06-14 07:22:02: ERROR[Main]: stack traceback:
2019-06-14 07:22:02: ERROR[Main]: 	/media/sda3/Minetest/server4/.minetest/mods/ranks/init.lua:59: in function 'get_rank'
2019-06-14 07:22:02: ERROR[Main]: 	/media/sda3/Minetest/server4/.minetest/mods/ranks/init.lua:225: in function </media/sda3/Minetest/server4/.minetest/mods/ranks/init.lua:223>
2019-06-14 07:22:02: ERROR[Main]: 	...minetest/bin/../share/minetest/builtin/game/register.lua:419: in function <...minetest/bin/../share/minetest/builtin/game/register.lua:399>

BlueR23
Member
Posts: 26
Joined: Thu Jul 23, 2020 15:34
GitHub: DiamondPlane
Location: Behind you

Re: [Mod] Advanced Ranks [ranks]

by BlueR23 » Post

Hi. Can someone help me? I want to make that the rank mod give a rank to a player that joined his first time in a server. Can someone tell me how I do it?

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Advanced Ranks [ranks]

by octacian » Post

Lol tfw it's been so long that you forgot what your own mod can and can't do.

So register your rank normally, and use the following code to give that rank to each first-time player:

Code: Select all

minetest.register_on_newplayer(function(player)
	ranks.set_rank(player, "<rank name>")
end)
It doesn't really matter where you place the code snippet above, like at all as far as I remember.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

BlueR23
Member
Posts: 26
Joined: Thu Jul 23, 2020 15:34
GitHub: DiamondPlane
Location: Behind you

Re: [Mod] Advanced Ranks [ranks]

by BlueR23 » Post

octacian wrote:
Tue Dec 22, 2020 07:10
Lol tfw it's been so long that you forgot what your own mod can and can't do.

So register your rank normally, and use the following code to give that rank to each first-time player:

Code: Select all

minetest.register_on_newplayer(function(player)
	ranks.set_rank(player, "<rank name>")
end)
It doesn't really matter where you place the code snippet above, like at all as far as I remember.
It doesn't work for me. Should I put it in init.lua?

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Advanced Ranks [ranks]

by octacian » Post

BlueR23 wrote:
Tue Dec 22, 2020 08:49
It doesn't work for me. Should I put it in init.lua?
Sure, try putting it right after wherever you register your rank. And make sure that you replace <rank name> in the code snippet I gave with the exact name of your rank.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

BlueR23
Member
Posts: 26
Joined: Thu Jul 23, 2020 15:34
GitHub: DiamondPlane
Location: Behind you

Re: [Mod] Advanced Ranks [ranks]

by BlueR23 » Post

Thanks! I just forgot to write the rank name!

BlueR23
Member
Posts: 26
Joined: Thu Jul 23, 2020 15:34
GitHub: DiamondPlane
Location: Behind you

Re: [Mod] Advanced Ranks [ranks]

by BlueR23 » Post

Ok, I have another question: I want to make that when I give someone a rank it gives the privs automatically to the player. Can you help with it? Is there a function to do it?

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Advanced Ranks [ranks]

by octacian » Post

BlueR23 wrote:
Wed Dec 23, 2020 08:09
Ok, I have another question: I want to make that when I give someone a rank it gives the privs automatically to the player. Can you help with it? Is there a function to do it?
Yup, that is a core feature of this mod. In your ranks definition include a privileges table, for example:

Code: Select all

ranks.register("<rank name here>", {
	-- other rank configuration here, as documented in API linked below
	privs = {
		fly = true, -- give all players with this rank the fly privilege
		fast = false, -- remove the fast privilege from all players with this rank
		-- etc...
	}
}
Don't forget to check out the API documentation on GitHub: https://github.com/octacian/ranks/blob/master/API.md
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

BlueR23
Member
Posts: 26
Joined: Thu Jul 23, 2020 15:34
GitHub: DiamondPlane
Location: Behind you

Re: [Mod] Advanced Ranks [ranks]

by BlueR23 » Post

octacian wrote:
Thu Dec 24, 2020 22:36
BlueR23 wrote:
Wed Dec 23, 2020 08:09
Ok, I have another question: I want to make that when I give someone a rank it gives the privs automatically to the player. Can you help with it? Is there a function to do it?
Yup, that is a core feature of this mod. In your ranks definition include a privileges table, for example:

Code: Select all

ranks.register("<rank name here>", {
	-- other rank configuration here, as documented in API linked below
	privs = {
		fly = true, -- give all players with this rank the fly privilege
		fast = false, -- remove the fast privilege from all players with this rank
		-- etc...
	}
}
Don't forget to check out the API documentation on GitHub: https://github.com/octacian/ranks/blob/master/API.md
It doesn't work...

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: [Mod] Advanced Ranks [ranks]

by debiankaios » Post

Please add a command to remove ranks of a player ingame.

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: [Mod] Advanced Ranks [ranks]

by debiankaios » Post

Whyever the chatprefix will not disabled on my server. i set in settingtypes.lua:

Code: Select all

#    If this is enabled, chat send by a player with a rank including a defined
#    prefix is prefixed with the rank prefix.
ranks.prefix_chat (Prefix Chat) bool false
and on my server it will writen in chat. You can test it byelf: debiankaios.host.oddprotocol.org:30005 you have on beginn the rank newbie

User avatar
Lone_Wolf
Member
Posts: 2575
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Advanced Ranks [ranks]

by Lone_Wolf » Post

debiankaios wrote:
Wed Oct 20, 2021 12:03
Whyever the chatprefix will not disabled on my server. i set in settingtypes.lua:

Code: Select all

#    If this is enabled, chat send by a player with a rank including a defined
#    prefix is prefixed with the rank prefix.
ranks.prefix_chat (Prefix Chat) bool false
and on my server it will writen in chat. You can test it byelf: debiankaios.host.oddprotocol.org:30005 you have on beginn the rank newbie
Never edit settingtypes.txt

Go to your minetest settings and search prefix. You should see the setting
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: [Mod] Advanced Ranks [ranks]

by debiankaios » Post

Lone_Wolf wrote:
Sat Oct 23, 2021 05:40
debiankaios wrote:
Wed Oct 20, 2021 12:03
Whyever the chatprefix will not disabled on my server. i set in settingtypes.lua:

Code: Select all

#    If this is enabled, chat send by a player with a rank including a defined
#    prefix is prefixed with the rank prefix.
ranks.prefix_chat (Prefix Chat) bool false
and on my server it will writen in chat. You can test it byelf: debiankaios.host.oddprotocol.org:30005 you have on beginn the rank newbie
Never edit settingtypes.txt

Go to your minetest settings and search prefix. You should see the setting
It's a minetest server there it isn't possible. There are no guis.

User avatar
Lone_Wolf
Member
Posts: 2575
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Advanced Ranks [ranks]

by Lone_Wolf » Post

debiankaios wrote:
Sat Oct 23, 2021 07:13
Lone_Wolf wrote:
Sat Oct 23, 2021 05:40
debiankaios wrote:
Wed Oct 20, 2021 12:03
Whyever the chatprefix will not disabled on my server. i set in settingtypes.lua:

Code: Select all

#    If this is enabled, chat send by a player with a rank including a defined
#    prefix is prefixed with the rank prefix.
ranks.prefix_chat (Prefix Chat) bool false
and on my server it will writen in chat. You can test it byelf: debiankaios.host.oddprotocol.org:30005 you have on beginn the rank newbie
Never edit settingtypes.txt

Go to your minetest settings and search prefix. You should see the setting
It's a minetest server there it isn't possible. There are no guis.
oops, try ranks.prefix_chat = false in your server minetest.conf then
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: [Mod] Advanced Ranks [ranks]

by debiankaios » Post

Thank you it work

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Advanced Ranks [ranks]

by Miniontoby » Post

Hey, I added IRC support and updated the mod so it doesnt give deprecated error
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests