--Bonus Afk code \Script\cmdp function afk_code_time() afk_1 = 30 --30 afk_2 = 60 --60 limite = 11 --11 return afk_1, afk_2 , limite end function check_my_afk_code() afk_1 , afk_2 , limite = afk_code_time() --afk bonus --cmdp_afk_reseend --cmdp_afk ( name , id ) player_time = tonumber(get_flag("afkt")) or 0 --get_flag (flag_name) gets a value of existing character's flag Character-Flag --set_flag (flag_name, value) inserts a flag to character's flag_list or update a flag if it exists Character-Flag --del_flag (flag_name) ------------------------------- Bonus WEEK END AFK -------------------------------------------- point = 1 bonus = 1 current_time = get_os_date( "%Y-%m-%d %H:%M:%S" ) week1_begin_time = '2022-04-22 00:00:00' --1차 종료 week2_begin_time = '2022-04-25 00:00:00' --2차 종료 if current_time >= week1_begin_time and current_time <= week2_begin_time then bonus = 2 end total_point = point * bonus ----------------------------------------------------------------------------------------------- set_flag("afkt", player_time + 1) player_time = tonumber(get_flag("afkt")) if player_time < 0 then del_flag("afkt") del_flag("afkc") player_time = tonumber(get_flag("afkt")) or 0 end if player_time == afk_1 then r = add_currency("afk", total_point ) end if player_time == afk_2 then r = add_currency("afk", total_point ) seed = RandomVariable(random(4,6)) set_flag("afkc", seed ) private_notice(sconv("Ecrire : /afk % pour obtenir un bonus de points AFK !" , "%" , get_flag("afkc"))) end if player_time > afk_2 and player_time <= (afk_2+limite) then private_notice(sconv(" /afk % | Expire dans $ Minute(s)" , "%" , get_flag("afkc") , "$" , (afk_2+limite) - tonumber(get_flag("afkt"))) ) end if player_time > (afk_2+limite) then set_flag("afkt", player_time - (afk_2+limite) ) del_flag("afkc") private_notice("cmd /afk expiré") end end function cmdp_afk ( name , id ) afk_1 , afk_2 , limite = afk_code_time() ------------------------------- Bonus WEEK END AFK -------------------------------------------- point = 2 bonus = 1 current_time = get_os_date( "%Y-%m-%d %H:%M:%S" ) week1_begin_time = '2022-04-22 00:00:00' --1차 종료 week2_begin_time = '2022-04-25 00:00:00' --2차 종료 if current_time >= week1_begin_time and current_time <= week2_begin_time then bonus = 2 end total_point = point * bonus ----------------------------------------------------------------------------------------------- if get_flag("afkc") == "" or get_flag("afkc") == nil then cmdp_afk_reseend() end player_time = tonumber(get_flag("afkt")) or 0 if player_time < 0 then -- Anti glitch set_flag("afkt" , 0 ) del_flag("afkc") player_time = tonumber(get_flag("afkt")) or 0 return end if tonumber(id) == tonumber(get_flag("afkc")) and get_flag("afkt") >= 60 then r = add_currency("afk", total_point ) set_flag("afkt", tonumber(get_flag("afkt")) - afk_2 ) del_flag("afkc") else cprint("not get_flag afkc ") cmdp_afk_reseend() end end function cmdp_afk_reseend() afk_1 , afk_2 , limite = afk_code_time() player_time = tonumber(get_flag("afkt")) or 0 private_notice("Temps afk = " .. player_time .. " Minute(s)") if get_flag("afkc") == "" or get_flag("afkc") == nil then return end private_notice(sconv(" /afk % | Expire dans $ Minute(s)" , "%" , get_flag("afkc") , "$" , (afk_2+limite) - tonumber(get_flag("afkt")) )) end function RandomVariable(length) res = "" for i = 1, length do --res = res .. string.char(math.random(97, 122)) res = res .. math.random(0, 9) end return res end