\begin{Verbatim}[commandchars=\\\{\}] \PY{c+c1}{\PYZhy{}\PYZhy{} by gera, public domain} \PY{k+kd}{local}\PY{+w}{ }\PY{n+nv}{file\PYZus{}path}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{get\PYZus{}worldpath}\PY{p}{()}\PY{+w}{ }\PY{o}{..}\PY{+w}{ }\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{/online\PYZus{}players.txt}\PY{l+s+s2}{\PYZdq{}} \PY{k+kr}{function}\PY{+w}{ }\PY{n+nf}{erase\PYZus{}player\PYZus{}list}\PY{p}{()} \PY{+w}{ }\PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{safe\PYZus{}file\PYZus{}write}\PY{p}{(}\PY{n+nv}{file\PYZus{}path}\PY{+w}{ }\PY{p}{,}\PY{+w}{ }\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)} \PY{k+kr}{end} \PY{k+kr}{function}\PY{+w}{ }\PY{n+nf}{dump\PYZus{}player\PYZus{}list}\PY{p}{(}\PY{n+nv}{excludeme}\PY{p}{)} \PY{+w}{ }\PY{k+kd}{local}\PY{+w}{ }\PY{n+nv}{players}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{get\PYZus{}connected\PYZus{}players}\PY{p}{()} \PY{+w}{ }\PY{k+kd}{local}\PY{+w}{ }\PY{n+nv}{str}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{\PYZdq{}} \PY{+w}{ }\PY{k+kr}{for}\PY{+w}{ }\PY{n+nv}{i}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mi}{1}\PY{p}{,}\PY{+w}{ }\PY{o}{\PYZsh{}}\PY{n+nv}{players}\PY{+w}{ }\PY{k+kr}{do} \PY{+w}{ }\PY{k+kr}{if}\PY{+w}{ }\PY{n+nv}{players}\PY{p}{[}\PY{n+nv}{i}\PY{p}{]}\PY{+w}{ }\PY{o}{\PYZti{}=}\PY{+w}{ }\PY{n+nv}{excludeme}\PY{+w}{ }\PY{k+kr}{then} \PY{+w}{ }\PY{n+nv}{str}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nv}{str}\PY{+w}{ }\PY{o}{..}\PY{+w}{ }\PY{n+nv}{players}\PY{p}{[}\PY{n+nv}{i}\PY{p}{]:}\PY{n+nf}{get\PYZus{}player\PYZus{}name}\PY{p}{()}\PY{+w}{ }\PY{o}{..}\PY{+w}{ }\PY{l+s+s2}{\PYZdq{}}\PY{l+s+se}{\PYZbs{}n}\PY{l+s+s2}{\PYZdq{}} \PY{+w}{ }\PY{k+kr}{end} \PY{+w}{ }\PY{k+kr}{end} \PY{+w}{ }\PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{safe\PYZus{}file\PYZus{}write}\PY{p}{(}\PY{n+nv}{file\PYZus{}path}\PY{p}{,}\PY{+w}{ }\PY{n+nv}{str}\PY{p}{)} \PY{k+kr}{end} \PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{register\PYZus{}on\PYZus{}mods\PYZus{}loaded}\PY{p}{(}\PY{n+nv}{erase\PYZus{}player\PYZus{}list}\PY{p}{)} \PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{register\PYZus{}on\PYZus{}joinplayer}\PY{p}{(}\PY{k+kr}{function}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{n+nf}{dump\PYZus{}player\PYZus{}list}\PY{p}{(}\PY{k+kc}{nil}\PY{p}{)}\PY{+w}{ }\PY{k+kr}{end}\PY{p}{)} \PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{register\PYZus{}on\PYZus{}leaveplayer}\PY{p}{(}\PY{n+nv}{dump\PYZus{}player\PYZus{}list}\PY{p}{)} \PY{n+nv}{minetest}\PY{p}{.}\PY{n+nf}{register\PYZus{}on\PYZus{}shutdown}\PY{p}{(}\PY{n+nv}{erase\PYZus{}player\PYZus{}list}\PY{p}{)} \end{Verbatim}