//=========================================
// 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;
}