divide bandwidth between active users Help

slam..
i have 1 m speed line = 1024/256 KB
i want divide bandwidth between active users only
i her about this script use in schedule

:global host
:global uspeed 256
:global dspeed 1024
:global maxu
:global maxd
/ip hotspot host ;\
:foreach nm in=[find]\
do={\
:global byte1 [get $nm bytes-out]
}
:delay 1m
/ip hotspot host ;\
:foreach nm in=[find]\
do={\
:global byte2 [get $nm bytes-out]
:global bytenew ($byte2 - $byte1)
:if ($bytenew > 15000000)\
do={\
:global nm 0
:set host ($nm + 1)
:set maxd (($uspeed / $host)*1000)
:set maxu (($dspeed / $host)*1000)
:global ip [get $nm address]
/queue simple ;\
remove [find name=$ip] ;\
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment=newmind direction=both disabled=no \
    interface=all limit-at="$maxu/$maxd" max-limit="$maxu/$maxd" name=$ip packet-marks="" parent=none priority=4 \
    queue=default-small/default-small target-addresses=$ip total-queue=default-small;\
remove [find name!=$ip] ;\
}}}

but i can’t use it
please help me how i use it
or >>>>>>>>>>>>>>>>>
the true way to divide bandwidth between active users only
best regards

help …
up…

http://www.youtube.com/watch?v=lMDZ9uiMOoc

THIS YOUTUBE TALK ABOUT THIS ROWL

/ip firewall mangle add chain=forward src-address=192.168.1.0/24 action=mark-connection new-connection-mark=NET1-CM
/ip firewall mangle add connection-mark=NET1-CM action=mark-packet new-packet-mark=NET1-PM chain=forward
/queue type add name=pcq_downsteam kind=pcq pcq-classifier=dst-address
/queue type add name=pcq_upstream kind=pcq pcq-classifier=src-address
/queue tree add parent=lan queue=pcq_downsteam packet-mark=NET1-PM
/queue tree add parent=public queue=pcq_upstream packet-mark=NET1-PM

i know this code b4
but this code like hotspot code

i want something else
just example

we are 6 users use 1024 / 128 kb = 1 -mb
1- when 1 user active i want hem get all the line 1024 kb
2- when become 2 users active online .. every one get 512 kb
2- when become 4 users active online .. every one get 256 kb
and
if one shut down and they become 3 users active …
1024 / 3 = 341.3 kb
is that possible ?

best regards..