I need Help urgent please pleasse

:frowning:

Dear Support,

Kindly, i need to make script all details below :

Example :frowning: : if username reached limit-bytes-total , then ( disable the limit-bytes-total and change profile for this user to another profile) else don’t make anything.

Please please support make to me script for this issue if possible coz i need it urgent , i’m write script but not problem and show to me error coz i don’t have any experiences for script mikrotik low .

I’m wait from you good reply about this is issue ASAP.


Thank you for cooperating with me in advance and thank you for help me again.

I want to informed you im use hotspot system to limit users ..

try this and comment


foreach userhotspot in=[/ip hotspot user find] do={
#change (example 200 Mb) limit traffic per user
local limitraf 2
local Mb (1024*1024)
local totaltraf ($limitraf*$Mb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile test1 for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=test1}
}

Thank you for help me , but not understand what do you mean for this script .
I told you , i have 200 user and but im limited user for 4G 30day and profile default without limit for speed , i want when user reached the 4G the limit-total , the limit-total be zero and transfer to another profile down the speed to 400Kbps .

As well as if possible explain me that to check it if work or not please please .

Thank you again for help me , i will happy for your reply in hurry .

Sir,

I make the script below :

foreach userhotspot in=[/ip hotspot user find] do={
#change 
local limitraf 4
local Gb (1000*1000*1000)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile ChangSO4G for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=ChangSO4G}
}

please check it correct or not correct …


Thank you again .

foreach userhotspot in=[/ip hotspot user find] do={
#change limitraf  
local limitraf 4
local Gb (1024*1024*1024)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile ChangSO4G for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=ChangSO4G}
}

and reset counter

foreach userhotspot in=[/ip hotspot user find] do={
ip hotspot user  reset-counters $userhotspot
}

Thank you for this is script, but i want reset counter just for user reached the limit and transfer to another profile , good transfer to another profile but the reset counter for user the reached limit only , coz im run the script reset counter for all users ..

Please help me if possible …



foreach userhotspot in=[/ip hotspot user find] do={
#change limitraf
local limitraf 4
local Gb (1000*1000*1000)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile test1 for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=test1}
}
/ip hotspot user reset-counters [find where profile="test1"]

Thank you my friend for help me , and i give you karma.

My friend,

Kindly, I have problem right now, coz i have 200user, 150user limited and 50 user not limited and take another profile , when run this script will apply on all user and and when byte-in and byte-out for all user will transfer to another profile , if possible resolve me this problem i will be happy from you to help me .

Thank you for help me in advance and thank you for all Team support mikrotk .

My friend,

Kindly, I have problem right now, coz i have 200user, 150user limited and 50 user not limited and take another profile , when run this script will apply on all users and when (byte-in and byte-out= 4G ) for all user will transfer to another profile , if possible resolve me this problem i will be happy from you to help me .

Thank you for help me in advance and thank you for all Team support mikrotik .

Any update please , coz i need this script ASAP.

add comment "limited"for each user limited



foreach userhotspot in=[/ip hotspot user find comment=limited] do={
#change limitraf
local limitraf 4
local Gb (1000*1000*1000)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile test1 for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=test1}
}
/ip hotspot user reset-counters [find where profile="test1"]

Is this what you’re trying to do?

For each user where bytes-in + bytes-out is greater than 4GB, reset-counters and change profile for them:

foreach userhotspot in=[ /ip hotspot user find ( (bytes-in + bytes-out) > 4294967296 ) ] do={
	/ip hotspot user reset-counters $userhotspot
	/ip hotspot user set $userhotspot profile=test
}

Dear,

If replace the comment by profile work or not , example:

foreach userhotspot in=[/ip hotspot user find profile=G4G] do={
#change limitraf
local limitraf 4
local Gb (1000*1000*1000)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile test1 for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=test1}
}
/ip hotspot user reset-counters [find where profile="test1"]

Please this is correct or not.

I’ll wait reply from you…

is ok

Dear Sir,

This script not work at this days, i don’t when the problem .. version package is 5.19 ..

foreach userhotspot in=[/ip hotspot user find profile=Use1M] do={
#change limitraf
local limitraf 2
local Gb (1000*1000*1000)
local totaltraf ($limitraf*$Gb)
local in [ip hotspot user get $userhotspot bytes-in]
local out [ip hotspot user get $userhotspot bytes-out ]
local total ($in+$out)
#change profile Cutservice for user 
if ($total>$totaltraf) do={/ip hotspot user set $userhotspot profile=Cutservice}
}

when run this script take all users limited and change the profile , please help me for this problem coz i have Quite a few users.

I’ll wait your solve from you , thank you for cooperating with me and thank you for your support .

why not working??
because is wrong?

I will use user manager would you please give me link to check user limit down and up and user manger change profile when user reache limited ..