:log info ("User login: $user")
:log info ("IP: ".$address)
:log info ("Mac Address:" $user mac-address)
:local uname $user;
:local usercount 0;
:local usertime "00:00:00";
:local kickable;
:local maxuser 1;
:foreach i in=[/ip hotspot active find user=$uname] do= {
:local curup [/ip hotspot active get $i uptime];
:if ( $curup > $usertime ) do={
:set usertime $curup;
:set kickable $i;
}
:set usercount ($usercount+1);
}
:if ($usercount >= $maxuser) do={
:log info "Login user: $uname ($usercount/$maxuser) - Oldest $usertime will be logout!";
/ip hotspot active remove numbers=$kickable;
} else {
:log info "Login user: $uname ($usercount/$maxuser)";
}