Add /list
This commit is contained in:
		| @@ -2,7 +2,17 @@ local http_api = minetest.request_http_api() | ||||
|  | ||||
| function send_messages(res) | ||||
| 	for message in string.gmatch(res["data"], "[^\n]+") do | ||||
| 		minetest.chat_send_all(message) | ||||
| 		if message == "list" then | ||||
| 			local x = minetest.get_connected_players() | ||||
| 			local text = "List of Players:\n" | ||||
| 			for j, i  in ipairs(x) do | ||||
| 				local text = text .. i.get_player_name(i) | ||||
| 			end | ||||
| 			http_api.fetch_async({url = "http://localhost:" .. port .. "/sendCode", | ||||
| 					post_data = {message = text}}) | ||||
| 		else | ||||
| 			minetest.chat_send_all(message) | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user