Jump to content
  • 0

Trouble in a script vip


deehrox

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  12/13/12
  • Last Seen:  

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 .@varName$, "$AM_Vip" +  getarg (2, getcharid (3)) + "[" + getarg (1, 1) + "]";
callfunc ("vip_update",  getarg (2, getcharid (3)), 0);

setd .@varName$, (getd (.@varName$) + getarg (0) > 0) ? getd (.@varName$) + 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 .@aid, getarg (0, getcharid (3));

for (set .@i, 0; .@i <= $@AM_Vip_CountGroups; set .@i, .@i + 1)
	setd "$AM_Vip" + .@aid + "[" + $@AM_Vip_Groups[.@i] + "]", 0;

return callfunc ("vip_refresh", 0, .@aid);
}

// vip_read (group_id=0, uid=getcharid(3), update=true)
function	script	vip_read	{
set .@aid, getarg (1, getcharid (3));

if (getarg (2, 1))
	callfunc ("vip_update", .@aid, 0);
if (getarg (0, 0))
	return getd ("$AM_Vip" + .@aid + "[" + getarg (0, 0) + "]");

for (set .@i, 0; $@AM_Vip_Groups[.@i]; set .@i, .@i + 1)
	set .@t, .@t + getd ("$AM_Vip" + .@aid + "[" + $@AM_Vip_Groups[.@i] + "]");
return .@t;
}

// 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/$@AM_VipLevel)
function	script	vip_listgroupid	{
set .@aid, getarg (0, getcharid (3));
set .@varName$, getarg (1, getcharid (3) ? "@AM_VipLevel" : "$@AM_VipLevel");

callfunc ("vip_update", .@aid, 0);
for (set .@i, $@AM_Vip_CountGroups - 1; .@i >= 0; set .@i, .@i - 1)
{
	set .@groupid, $@AM_Vip_Groups[.@i];
	if (getd ("$AM_Vip" + .@aid + "[" + .@groupid + "]"))
	{
		setd .@varName$ + "[" + .@amount + "]", .@groupid;
		set .@amount, .@amount + 1;
	}
}
return .@amount;
}

// vip_update (uid=getcharid(3), refresh=true)
function	script	vip_update	{
set .@aid, getarg (0, getcharid (3));
set .@now, gettimetick (2);
set .@remove, .@now - getd ("$AM_Vip" + .@aid);

for (set .@i, $@AM_Vip_CountGroups - 1; .@i >= 0 && .@remove >= 0; set .@i, .@i - 1)
{
	set .@groupid, $@AM_Vip_Groups[.@i];
	set .@varName$, "$AM_Vip" + .@aid + "[" + .@groupid + "]";
	if (getd (.@varName$) > 0)
		set .@remove, .@remove - getd (.@varName$);
	setd .@varName$, (.@remove < 0) ? (-.@remove) : 0;
}
if (.@remove >= 0)
	set .@groupid, 0;
setd "$AM_Vip" + .@aid, .@now;

if (getarg (1, 1))
	return callfunc ("vip_refresh", .@groupid, .@aid);
return .@groupid;
}

// vip_refresh (group_id=0, uid=getcharid(3))
function	script	vip_refresh	{
if (isloggedin (getarg (1, getcharid (3))))
{
	set .@rid, getcharid (3);
	attachrid getarg (0, getcharid (3));
	if (getgroupid() != getarg (0, 0) && $@AM_Vip_IsValidGroup[getgroupid()])
		atcommand "@adjgroup " + getarg (0, 0);
	if (!@AM_Vip_DisableManager && !$@AM_Vip_DisableManager)
		callfunc ("vipm_refresh", getarg (1, getcharid (3)));
	attachrid .@rid;
}
if ($@AM_Vip_AlterSQL)
{
	query_sql "SELECT `group_id` FROM `login` WHERE `account_id`='" + getarg (1, getcharid (3)) + "'", .@groupid;
	if (.@groupid != getarg (0, 0) && $@AM_Vip_IsValidGroup[.@groupid])
		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 $@AM_Vip_IsValidGroup;

set $@AM_Vip_IsValidGroup[0], 1;
for (set .@i, 0; $@AM_Vip_Groups[.@i]; set .@i, .@i + 1)
	set $@AM_Vip_IsValidGroup[$@AM_Vip_Groups[.@i]], 1;

set $@AM_Vip_CountGroups, .@i;
return;
}

// VipManager
//-------------------------------------------
-	script	vipm_npc	-1,{
OnInit:
	if (!$@AM_Vip_CountGroups)
	{
		// from worse to better group id
		setarray $@AM_Vip_Groups, 10;
		callfunc ("vip_reload_groups");
	}
	end;
OnPCLoginEvent:
	callfunc ("vipm_refresh");
	end;
OnRefreshVip:
	if (@AM_Vip_DisableManager || $@AM_Vip_DisableManager || !$@AM_Vip_IsValidGroup[getgroupid()])
		end;

	deltimer "vipm_npc::OnRefreshVip";
	if (set (.@time, callfunc ("vip_read", set (.@groupid, callfunc ("vip_getgroupid")), getcharid(3), 0)) > 0)
		addtimer 1000 + ((.@time >= 86400) ? 86400 : .@time) * 1000, "vipm_npc::OnRefreshVip";

	set @AM_Vip_DisableManager, 1;
	callfunc ("vip_refresh", .@groupid);
	set @AM_Vip_DisableManager, 0;

	callfunc ("vipm_force_call");
	end;
}

// vipm_force_call (uid=getcharid(3))
function	script	vipm_force_call	{
set .@aid, getarg (0, getcharid (3));
if (!.@aid || isloggedin (.@aid))
{
	set .@rid, getcharid (3);
	for (set .@i, 0; .@i < getarraysize ($@AM_Vip_CallOnRefresh$); set .@i, .@i + 1)
		if (is_function ($@AM_Vip_CallOnRefresh$))
		{
			attachrid .@aid;
			callfunc ($@AM_Vip_CallOnRefresh$, .@rid);
		}
	attachrid .@rid;
}
return;
}

// vipm_refresh (uid=getcharid(3))
function	script	vipm_refresh	{
set .@aid, getarg (0, getcharid (3));
if (isloggedin (.@aid))
{
	set .@rid, getcharid (3);
	attachrid .@aid;
	addtimer 1000, "vipm_npc::OnRefreshVip";
	attachrid .@rid;
}
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 (.@time, getarg (0)) > 0)
	for (set .@i, 0; .@i < .unitSize; set .@i, .@i + 1)
		if (.@time >= .unit[.@i])
		{
			if (.@i + 1 < .unitSize)
			{
				set .@lTime, (.@time % .unit[.@i]) / .unit[.@i + 1];
				//set .@lTime$, " and " + .@lTime + .unit$[2*(.@i + 1) + (.@lTime != 1)];
				set .@lTime$, " e " + .@lTime + .unit$[2*(.@i + 1) + (.@lTime != 1)];
			}
			return (.@time / .unit[.@i]) + .unit$[2*.@i + (.@time / .unit[.@i] != 1)] + .@lTime$;
		}
return "0" + .unit$[2*.unitSize - 1];
}

//vip


Edited by deehrox
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  12/13/12
  • Last Seen:  

As well, I am new to scripting, do not understand much. helps me do this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Developers will help you better if you use the right format.

YOUR SCRIPT

use that when posting.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  12/13/12
  • Last Seen:  

Ok. ready

Look, a new guy came into my server with nick: x milestones

The vip his normal functioning, and relogando etc.

Another player with nick: Ty Mts

Took vip worked when he left and enter the server again left the vip.

How to by all accounts work?

?

?

.

help

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

// vip set function ...
setd "$AM_Vip" + getarg (2, getcharid (3)) + "[" + getarg (1, 1) + "]", (getarg (0) > 0) ? getarg (0) : 0;
// vip read function
setd "$AM_Vip" + .@aid + "[" + $@AM_Vip_Groups[.@i] + "]", 0;

I DO NOT AGREE having this kind of script on your server !

read here and understand what it is

http://www.eathena.ws/board/index.php?s=&showtopic=181741&view=findpost&p=1478950

its better you go find another one

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  43
  • Reputation:   15
  • Joined:  06/24/12
  • Last Seen:  

@deehrox

If you're new to scripting, I guess you shoudn't be using Rafael Perella's CashLib system...

In Cronus, it exists to turn the job of making cash related events easier, requiring an average knowledge on scripting.

Try using the optimized Pixel's VIP System (Você já é do Cronus, então não vai ser difícil encontrar o sistema do Pixel).

Also, Rafael said to me that his system has lots of future optimizations coming up, that turns the actual into a kind of "Beta".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...