Kit Mod

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

Kit Mod

by mcfan » Thu Mar 27, 2014 17:54

I have a small minitest sever and I have a Rank system Ive set up for it using command blocks and pressure plates. But what I'm looking for is a mod where someone can type /kit <rank> and get the items that their rank receives. It would also have a cool-down time of 24 hours and you would need to have a priv for each rank kit. Is this possible? I've tried using the giveme command to help me make a mod like this but I couldn't get it to work.
Love MINECRAFT... will settle for Minetest
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Thu Mar 27, 2014 18:47

upload your code somewhere and then it'll be easier to help you to find your errors and to get your mod working.

Anyway, I suggest making a global table:
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
ranks = {['user']={}, ['moderator'] = {}}

there you could store player names
then you may have another table with tables of kits:
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
kits = (['user']={itemstring1, itemstring2, etc}, ['moderator']={itemstring1, itemstring2, etc})


Then register your command and do smth like this:
(note, that any chat commandhave "name" var that stores invoker's name)
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
for i,group in ipairs(ranks) do
     if group[name] then
          local player = minetest.get_player_by_name(name)
          local inv = player:get_inv()
          for j,item in ipairs(kits[group]) do
               inv:add_item(ItemString(item))
          end
     break
     end
end


Code above is just an example, I'm sure I have syntax errors there.
Last edited by 4aiman on Thu Mar 27, 2014 18:48, edited 1 time in total.
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Thu Mar 27, 2014 19:00

I had some code (I tried 5 times) but I finally deleted it all and worked on other mods that is have. I don't understand exactly what you mean about the global table though.
Love MINECRAFT... will settle for Minetest
 

User avatar
domtron vox
Member
 
Posts: 106
Joined: Thu Feb 20, 2014 21:07
GitHub: DomtronVox
IRC: Domtron
In-game: Domtron

by domtron vox » Thu Mar 27, 2014 21:09

A global table is where you set a global variable to {} which allows you to store key/value pairs.
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 kits = {} --this is NOT a global table
kits = {} --this IS a global table


Are you looking for a mod were you make calls to it from another mod to add ranks and kits or do you want it to have a file for each rank where you can list all items that belong in a kit?

i.e. do you want
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
--mymod/init.lua

kitMod.addRank("user")
kitMod.addRank("moderator")

kitMod.addKit("user", "item1", "item2", "ect")


Or in kitMod/users.kit

item1
item2
ect
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Thu Mar 27, 2014 23:54

I want to be able to do - say that my rank is emerald- /kit emerald, and get in my inventory for example, 8 emeralds, 8 diamonds, ect. But if my rank is diamond - I'd be able to do /kit diamond and get my stuff which would be different.
Love MINECRAFT... will settle for Minetest
 

User avatar
LuxAtheris
Member
 
Posts: 169
Joined: Fri Oct 25, 2013 00:54

by LuxAtheris » Fri Mar 28, 2014 01:03

Ohh I know what his saying.
Its from that MC game where you type a kind of kit which then you get some items.
I played one of those games which had that.
Believe you can and you’re halfway there.
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Fri Mar 28, 2014 12:30

Yes! Is that something you can do? I'm not good at programming commands.
Love MINECRAFT... will settle for Minetest
 

User avatar
LuxAtheris
Member
 
Posts: 169
Joined: Fri Oct 25, 2013 00:54

by LuxAtheris » Fri Mar 28, 2014 13:39

mcfan wrote:Yes! Is that something you can do? I'm not good at programming commands.

Sorry to break it to you pal but im still learning to code. :/
Believe you can and you’re halfway there.
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Fri Mar 28, 2014 14:03

Oh that is too bad. lol. Anyone else here want to take a stab at it?
Love MINECRAFT... will settle for Minetest
 

User avatar
domtron vox
Member
 
Posts: 106
Joined: Thu Feb 20, 2014 21:07
GitHub: DomtronVox
IRC: Domtron
In-game: Domtron

by domtron vox » Fri Mar 28, 2014 22:31

 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Fri Mar 28, 2014 23:41

Thanks domtron vox.
Love MINECRAFT... will settle for Minetest
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Sat Mar 29, 2014 01:12

Didn't work:(
Love MINECRAFT... will settle for Minetest
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Sat Mar 29, 2014 17:22

I'm using 0.4.7, Is that a problem?
Love MINECRAFT... will settle for Minetest
 

User avatar
minermoder27
Member
 
Posts: 127
Joined: Wed Nov 20, 2013 23:24
GitHub: ZNixian
In-game: minermoder27

by minermoder27 » Sun Mar 30, 2014 07:47

If you can, update to 0.4.9 regardless of this: 0.4.7 is very old
My best mods:
Buildtest
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sun Mar 30, 2014 08:32

mcfan wrote:I'm using 0.4.7, Is that a problem?

It's always good to upgrade your version to support the newest functions/features.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
mcfan
Member
 
Posts: 120
Joined: Wed Mar 26, 2014 15:02

by mcfan » Sun Mar 30, 2014 11:15

The reason why I don't have 0.4.9 is because I installed it and there were a lot of bugs. So I tried to reinstall 0.4.8 but it was gone so I had to settle with 0.4.7.
Love MINECRAFT... will settle for Minetest
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 13 guests

cron