custom_skin = {}
custom_skin.texture = {}

minetest.register_on_joinplayer(function(player)
   local name = player:get_player_name()
   local filename = minetest.get_modpath('custom_skin')..'/textures/'..name..'.png'
   local f = io.open(filename)
   if f then
      f:close()
      default.player_set_textures(player, {name..'.png'})
      custom_skin.texture[name] = (name..'.png')
   else
      default.player_set_textures(player,{'no_skin.png'})
      custom_skin.texture[name] = ('no_skin.png')
   end
end)
