viewing paste Unknown #5015 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
//=========================================
// VipAdmin v1.3a - requirements:
// - AM VipLib v1.2b
// Desenvolvido por Rafael Perrella
//=========================================
 
Crystilia,89,89,4   script  VIP Administrator#RP    833,{
    doevent "#vipadmin::OnWhisperGlobal";
}
 
-   script  #vipadmin   -1,{
    OnWhisperGlobal:
 
    // Unidades para digitar o tempo VIP
    set .@UnitMenu$, "Months (30 days):Days:Hours:Minutes:Seconds:No one.";
    setarray .@UnitFactor, 30*86400, 86400, 3600, 60, 1, 0;
 
    mes "[^FF0000VipAdmin^000000]";
    if (getgmlevel () < 99)
    {
        mes "Wanna see your credits? :)";
        mes "Account number: ^FF0000" + (getcharid (3) - 2000000) + "^000000";
        callfunc ("vip_list_time");
        close;
    }
    mes "Input the username.";
    input .@username$;
    query_sql "SELECT `account_id` FROM `login` WHERE `userid`='" + escape_sql (.@username$) + "'", .@aid;
    if (!.@aid)
    {
        mes "This username doesn't exist.";
        close;
    }
 
    while (.@choice != 5)
    {
        next;
        set .@type, 0;
        mes "[^FF0000VipAdmin^000000]";
        mes "ID: ^FF8000" + .@aid + "^000000";
        mes "Number: ^FF8000" + (.@aid - 2000000) + "^000000";
        mes "Username: ^FF8000" + .@username$ + "^000000";
        if (!callfunc ("vip_list_time", .@aid))
            setd "$AM_Vip" + .@aid, 0;
        next;
        set .@choice, select ("Clear VIP", "Add VIP time", "Remove VIP time", "Set VIP time", "Exit");
        mes "[^FF0000VipAdmin^000000]";
        switch (.@choice)
        {
            case 1:
                mes "The user will lose all his VIP.";
                mes "Are you sure you want to do this?";
                if (select ("No, I don't want to clear his VIP.", "Yes, clear it!!") == 2)
                    callfunc ("vip_clear", .@aid);
                break;
 
            case 3:
                mes "Remove from the total time, or from a specific level?";
                set .@type, select ("Total time.", "Specific level.");
                set .@level, 0;
            case 2:
            case 4:
                mes "In what unity you want to input the VIP time?";
                if (!.@UnitFactor[select (.@UnitMenu$) - 1])
                    break;
                mes "Input the amount";
                input .@time;
                if (.@type != 1)
                {
                    mes "Input the VIP level.";
                    input .@level;
                }
                setarray .@func$, "vip_add", "vip_remove", "vip_set";
                callfunc (.@func$[.@choice - 2], .@time * .@UnitFactor[@menu - 1], .@level, .@aid);
                break;
        }
    }
    mes "Have a nice day ^^.";
    close;
}
 
// vip_list_time ([uid])
// [18/10] - bug fixed: name changed from vip_listTime to vip_list_time (thanks to uDe)
function    script  vip_list_time   {
    set .@aid, getarg (0, getcharid (3));
 
    // Exibe tempo total
    set .@time, callfunc ("vip_read", 0, .@aid);
    mes "Total: " + callfunc ("vipm_format_time", .@time);
 
    // Exibe tempos parciais (para cada nível)
    for (set .@i, callfunc ("vip_listgroupid", .@aid) - 1; .@i >= 0; set .@i, .@i - 1)
    {
        set .@levelTime, getd ("$AM_Vip" + .@aid + "[" + @AM_VipLevel[.@i] + "]");
        mes "Level ^FF8000" + @AM_VipLevel[.@i] + "^000000 [" + callfunc ("vipm_format_time", .@levelTime) + "]";
    }
    return .@time;
}
Viewed 810 times, submitted by Guest.