i need help with removing user from hotspot when connected to pppoe!!!!!

please help me with this:
i need script that remove user from hotspot when connected to pppoe :cry:
i have been tryin all day with no success

{:local i;
:set i [ :len [/ip hotspot active find] ];
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set uname [/ip hotspot active get $i user];
:ip hotspot active remove [find user=($uname)];
}
}

if you have the same user in hotspot and pppoe and you want to remove the user from active hotspot when connected to ppoe
just paste this rule in ppp profile script on-up

:ip hotspot active remove [find user=($user)];