diff --git a/chat.lua b/chat.lua index e9c936a..8781a7e 100644 --- a/chat.lua +++ b/chat.lua @@ -1,122 +1,128 @@ -minetest.register_on_chat_message(function(name, message, playername, player) - local cmd ="/chats" - if message:sub(0, #cmd) == cmd then - if message == '/chats' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_player(name, "Available commands - /afk, /back, /here, /there, /happy, /sad, /surprised, /mad, /funny, /crazy, /hurt, /mining") - return true - end - end - local cmd ="/afk" - if message:sub(0, #cmd) == cmd then - if message == '/afk' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is AFK! ") - return true - end - end - local cmd ="/back" - if message:sub(0, #cmd) == cmd then - if message == '/back' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is Back! ") - return true - end - end - local cmd ="/happy" - if message:sub(0, #cmd) == cmd then - if message == '/happy' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is Happy! ") - return true - end - end - local cmd ="/sad" - if message:sub(0, #cmd) == cmd then - if message == '/sad' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is Sad! ") - return true - end - end - local cmd ="/surprised" - if message:sub(0, #cmd) == cmd then - if message == '/surprised' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is Surprised! ") - return true - end - end - local cmd ="/mad" - if message:sub(0, #cmd) == cmd then - if message == '/mad' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is Soooooooooo Mad! ") - return true - end - end - local cmd ="/here" - if message:sub(0, #cmd) == cmd then - if message == '/here' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all("The amazing "..name.." is here! ") - return true - end - end - local cmd ="/there" - if message:sub(0, #cmd) == cmd then - if message == '/there' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is not there! "..name.." is here") - return true - end - end - local cmd ="/funny" - if message:sub(0, #cmd) == cmd then - if message == '/funny' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is sooooooooooooooooooooooooooooo funny! ") - return true - end - end - local cmd ="/crazy" - if message:sub(0, #cmd) == cmd then - if message == '/crazy' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is losing thier mind! ") - return true - end - end - local cmd ="/max" - if message:sub(0, #cmd) == cmd then - if message == '/max' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all("Max is the greatest guy ever! Except for Batman. Batman is better!") - return true - end - end - local cmd ="/bat" - if message:sub(0, #cmd) == cmd then - if message == '/bat' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all("Batman is the greatest guy ever! Except for Max. Max is better!") - return true - end - end - local cmd ="/hurt" - if message:sub(0, #cmd) == cmd then - if message == '/hurt' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is hurt!") - return true - end - end - local cmd ="/mining" - if message:sub(0, #cmd) == cmd then - if message == '/mining' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_all(name.." is mining!") - return true - end - end -end) + +minetest.register_chatcommand("chats", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_player(name,"Available commands - /afk, /back, /here, /there, /happy, /sad, /surprised, /mad, /funny, /crazy, /hurt, /mining") + return true + end, +}) +minetest.register_chatcommand("afk", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is AFK! ") + return true + end, +}) +minetest.register_chatcommand("back", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Back! ") + return true + end, +}) +minetest.register_chatcommand("gtg", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." needs to go now. Bye!") + return true + end, +}) +minetest.register_chatcommand("bbl", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is leaving and will be back later.") + return true + end, +}) +minetest.register_chatcommand("lol", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is laughing out loud! Ha Ha Ha Ha Ha Ha Ha ") + return true + end, +}) +minetest.register_chatcommand("happy", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Happy! ") + return true + end, +}) +minetest.register_chatcommand("sad", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Sad! ") + return true + end, +}) +minetest.register_chatcommand("surprised", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Surprised! ") + return true + end, +}) +minetest.register_chatcommand("mad", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Soooooooooo Mad! ") + return true + end, +}) + +minetest.register_chatcommand("here", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all("The amazing "..name.." is here! ") + return true + end, +}) +minetest.register_chatcommand("there", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is not there! "..name.." is here") + return true + end, +}) +minetest.register_chatcommand("funny", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is soooooooooooo funny! ") + return true + end, +}) +minetest.register_chatcommand("crazy", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is losing their mind! ") + return true + end, +}) +minetest.register_chatcommand("hurt", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is hurt! ") + return true + end, +}) +minetest.register_chatcommand("mining", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all(name.." is Mining! ") + return true + end, +}) +minetest.register_chatcommand("max", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all("Max is the greatest guy ever! Except for Batman. Batman is better!") + return true + end, +}) +minetest.register_chatcommand("bat", { + privs = {talk = true}, + func = function(text) + minetest.chat_send_all("Batman is the greatest guy ever! Except for Max. Max is better!") + return true + end, +}) diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..bd9c665 Binary files /dev/null and b/screenshot.png differ