mirror of
https://github.com/niwla23/playerinfo.git
synced 2024-12-22 22:02:24 +01:00
Adding check if player is valid
This commit is contained in:
parent
8b9c5bf8cf
commit
3dbcebac0a
5
init.lua
5
init.lua
@ -12,7 +12,10 @@ minetest.register_chatcommand("seeinfo", {
|
|||||||
params = "<info>",
|
params = "<info>",
|
||||||
description = "Sets your info",
|
description = "Sets your info",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if not player then
|
||||||
|
return false, "Player not found"
|
||||||
|
end
|
||||||
local player2getinfo = minetest.get_player_by_name(param)
|
local player2getinfo = minetest.get_player_by_name(param)
|
||||||
minetest.chat_send_player(player:get_player_name(), player2getinfo:get_attribute("info"))
|
minetest.chat_send_player(player:get_player_name(), player2getinfo:get_attribute("info"))
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user