I'm having problem in script vip. It is a script that when someone activates a coupon item in the game, it works by giving one day vip pro player. So he ta strange account that has this function, click the player wins the vip for 1 day and is normal, it says that the person clicks, get vip for 1 day, but if relog loses vip. I do not know what can be. I think that's the name of the char Login or people. the script is not connected to MySQL php.
Example a person with name: Hell Jhony. The vip works for a day normally.
If: HellJhonyFlecha. If relog loses vip.
How to by all accounts and usernames work?
- script
//=========================================
// AccountManager :: VipLib v1.4b
// Desenvolvido por Rafael Perrella
//=========================================
// This version isn't compatible with eAthena revisions and Cronus old revisions
// If you still want this script running on these emulators, send me a message.
//=========================================
// vip_add (amount, group_id=1, uid=getcharid(3))
function script vip_add {
set
[email protected]$, "$AM_Vip" + getarg (2, getcharid (3)) + "[" + getarg (1, 1) + "]";
callfunc ("vip_update", getarg (2, getcharid (3)), 0);
setd
[email protected]$, (getd (
[email protected]$) + getarg (0) > 0) ? getd (
[email protected]$) + getarg (0) : 0;
return callfunc ("vip_update", getarg (2, getcharid (3)));
}
// vip_remove (amount, group_id=0, uid=getcharid(3))
function script vip_remove {
return callfunc ("vip_add", -getarg (0), getarg (1, 0), getarg (2, getcharid (3)));
}
// vip_set (amount, group_id=1, uid=getcharid(3))
function script vip_set {
callfunc ("vip_update", getarg (2, getcharid (3)), 0);
setd "$AM_Vip" + getarg (2, getcharid (3)) + "[" + getarg (1, 1) + "]", (getarg (0) > 0) ? getarg (0) : 0;
return callfunc ("vip_update", getarg (2, getcharid (3)));
}
// vip_clear (uid=getcharid(3))
function script vip_clear {
set
[email protected], getarg (0, getcharid (3));
for (set
[email protected], 0;
[email protected] <=
[email protected]_Vip_CountGroups; set
[email protected],
[email protected] + 1)
setd "$AM_Vip" +
[email protected] + "[" +
[email protected]_Vip_Groups[
[email protected]] + "]", 0;
return callfunc ("vip_refresh", 0,
[email protected]);
}
// vip_read (group_id=0, uid=getcharid(3), update=true)
function script vip_read {
set
[email protected], getarg (1, getcharid (3));
if (getarg (2, 1))
callfunc ("vip_update",
[email protected], 0);
if (getarg (0, 0))
return getd ("$AM_Vip" +
[email protected] + "[" + getarg (0, 0) + "]");
for (set
[email protected], 0;
[email protected]_Vip_Groups[
[email protected]]; set
[email protected],
[email protected] + 1)
set
[email protected],
[email protected] + getd ("$AM_Vip" +
[email protected] + "[" +
[email protected]_Vip_Groups[
[email protected]] + "]");
return
[email protected];
}
// vip_getgroupid (uid=getcharid(3))
function script vip_getgroupid {
return callfunc ("vip_update", getarg (0, getcharid (3)), 0);
}
// vip_listgroupid (uid=getcharid(3), varName = @AM_VipLevel/
[email protected]_VipLevel)
function script vip_listgroupid {
set
[email protected], getarg (0, getcharid (3));
set
[email protected]$, getarg (1, getcharid (3) ? "@AM_VipLevel" : "
[email protected]_VipLevel");
callfunc ("vip_update",
[email protected], 0);
for (set
[email protected],
[email protected]_Vip_CountGroups - 1;
[email protected] >= 0; set
[email protected],
[email protected] - 1)
{
set
[email protected],
[email protected]_Vip_Groups[
[email protected]];
if (getd ("$AM_Vip" +
[email protected] + "[" +
[email protected] + "]"))
{
setd
[email protected]$ + "[" +
[email protected] + "]",
[email protected];
set
[email protected],
[email protected] + 1;
}
}
return
[email protected];
}
// vip_update (uid=getcharid(3), refresh=true)
function script vip_update {
set
[email protected], getarg (0, getcharid (3));
set
[email protected], gettimetick (2);
set
[email protected],
[email protected] - getd ("$AM_Vip" +
[email protected]);
for (set
[email protected],
[email protected]_Vip_CountGroups - 1;
[email protected] >= 0 &&
[email protected] >= 0; set
[email protected],
[email protected] - 1)
{
set
[email protected],
[email protected]_Vip_Groups[
[email protected]];
set
[email protected]$, "$AM_Vip" +
[email protected] + "[" +
[email protected] + "]";
if (getd (
[email protected]$) > 0)
set
[email protected],
[email protected] - getd (
[email protected]$);
setd
[email protected]$, (
[email protected] < 0) ? (
[email protected]) : 0;
}
if (
[email protected] >= 0)
set
[email protected], 0;
setd "$AM_Vip" +
[email protected],
[email protected];
if (getarg (1, 1))
return callfunc ("vip_refresh",
[email protected],
[email protected]);
return
[email protected];
}
// vip_refresh (group_id=0, uid=getcharid(3))
function script vip_refresh {
if (isloggedin (getarg (1, getcharid (3))))
{
set
[email protected], getcharid (3);
attachrid getarg (0, getcharid (3));
if (getgroupid() != getarg (0, 0) &&
[email protected]_Vip_IsValidGroup[getgroupid()])
atcommand "@adjgroup " + getarg (0, 0);
if (
[email protected]_Vip_DisableManager &&
[email protected]_Vip_DisableManager)
callfunc ("vipm_refresh", getarg (1, getcharid (3)));
attachrid
[email protected];
}
if (
[email protected]_Vip_AlterSQL)
{
query_sql "SELECT `group_id` FROM `login` WHERE `account_id`='" + getarg (1, getcharid (3)) + "'",
[email protected];
if (
[email protected] != getarg (0, 0) &&
[email protected]_Vip_IsValidGroup[
[email protected]])
query_sql "UPDATE `login` SET `group_id`='" + getarg (0, 0) + "' WHERE `account_id`='" + getarg (1, getcharid (3)) + "'";
}
return getarg (0, 0);
}
// vip_reload_groups ()
function script vip_reload_groups {
deletearray
[email protected]_Vip_IsValidGroup;
set
[email protected]_Vip_IsValidGroup[0], 1;
for (set
[email protected], 0;
[email protected]_Vip_Groups[
[email protected]]; set
[email protected],
[email protected] + 1)
set
[email protected]_Vip_IsValidGroup[
[email protected]_Vip_Groups[
[email protected]]], 1;
set
[email protected]_Vip_CountGroups,
[email protected];
return;
}
// VipManager
//-------------------------------------------
- script vipm_npc -1,{
OnInit:
if (
[email protected]_Vip_CountGroups)
{
// from worse to better group id
setarray
[email protected]_Vip_Groups, 10;
callfunc ("vip_reload_groups");
}
end;
OnPCLoginEvent:
callfunc ("vipm_refresh");
end;
OnRefreshVip:
if (@AM_Vip_DisableManager ||
[email protected]_Vip_DisableManager ||
[email protected]_Vip_IsValidGroup[getgroupid()])
end;
deltimer "vipm_npc::OnRefreshVip";
if (set (
[email protected], callfunc ("vip_read", set (
[email protected], callfunc ("vip_getgroupid")), getcharid(3), 0)) > 0)
addtimer 1000 + ((
[email protected] >= 86400) ? 86400 :
[email protected]) * 1000, "vipm_npc::OnRefreshVip";
set @AM_Vip_DisableManager, 1;
callfunc ("vip_refresh",
[email protected]);
set @AM_Vip_DisableManager, 0;
callfunc ("vipm_force_call");
end;
}
// vipm_force_call (uid=getcharid(3))
function script vipm_force_call {
set
[email protected], getarg (0, getcharid (3));
if (
[email protected] || isloggedin (
[email protected]))
{
set
[email protected], getcharid (3);
for (set
[email protected], 0;
[email protected] < getarraysize (
[email protected]_Vip_CallOnRefresh$); set
[email protected],
[email protected] + 1)
if (is_function (
[email protected]_Vip_CallOnRefresh$))
{
attachrid
[email protected];
callfunc (
[email protected]_Vip_CallOnRefresh$,
[email protected]);
}
attachrid
[email protected];
}
return;
}
// vipm_refresh (uid=getcharid(3))
function script vipm_refresh {
set
[email protected], getarg (0, getcharid (3));
if (isloggedin (
[email protected]))
{
set
[email protected], getcharid (3);
attachrid
[email protected];
addtimer 1000, "vipm_npc::OnRefreshVip";
attachrid
[email protected];
}
return;
}
// vipm_format_time (time_in_seconds)
function script vipm_format_time {
if (! .unitSize)
{
//setarray .unit$, " month", " months", " day", " days", " hour", " hourss", " minute", " minutes", " second", " seconds";
setarray .unit$, " m�s"," meses", " dia"," dias", " hora"," horas", " minuto"," minutos", " segundo"," segundos";
setarray .unit, 30*86400, 86400, 3600, 60, 1;
set .unitSize, getarraysize (.unit);
}
// Seleciona as duas unidades que devem ser usadas e formata a string
if (set (
[email protected], getarg (0)) > 0)
for (set
[email protected], 0;
[email protected] < .unitSize; set
[email protected],
[email protected] + 1)
if (
[email protected] >= .unit[
[email protected]])
{
if (
[email protected] + 1 < .unitSize)
{
set
[email protected], (
[email protected] % .unit[
[email protected]]) / .unit[
[email protected] + 1];
//set
[email protected]$, " and " +
[email protected] + .unit$[2*(
[email protected] + 1) + (
[email protected] != 1)];
set
[email protected]$, " e " +
[email protected] + .unit$[2*(
[email protected] + 1) + (
[email protected] != 1)];
}
return (
[email protected] / .unit[
[email protected]]) + .unit$[2*
[email protected] + (
[email protected] / .unit[
[email protected]] != 1)] +
[email protected]$;
}
return "0" + .unit$[2*.unitSize - 1];
}
//vip