init.lua 512 B

1234567891011121314151617
  1. custom_skin = {}
  2. custom_skin.texture = {}
  3. minetest.register_on_joinplayer(function(player)
  4. local name = player:get_player_name()
  5. local filename = minetest.get_modpath('custom_skin')..'/textures/'..name..'.png'
  6. local f = io.open(filename)
  7. if f then
  8. f:close()
  9. default.player_set_textures(player, {name..'.png'})
  10. custom_skin.texture[name] = (name..'.png')
  11. else
  12. default.player_set_textures(player,{'no_skin.png'})
  13. custom_skin.texture[name] = ('no_skin.png')
  14. end
  15. end)