Jump to content
  • 0

Question

Posted

Hi people. I have this script for changing groups but I check the database and the char remains in the default group 0, I used it on an item and the message appears in the game that it was active but nothing is changed in the DB.

script:

Spoiler

-    script    vip_group_free    -1,{
    OnSetVIP:
        #TEMP_GROUP_V  = gettimetick(2) + (7 * 24 * 60 * 60);//time in seconds
    OnPCLoginEvent:
        if (#TEMP_GROUP_V > gettimetick(2)) {
            atcommand "@adjgroupid 5";
            .@second = #TEMP_GROUP_V - gettimetick(2);
            addtimer (.@second * 1000), strnpcinfo(3)+"::OnExpire";
            dispbottom "Seu VIP expira em: "+gettimestr("%Y-%m/%d %H:%M:%S",21,#TEMP_GROUP_V);
        }
        end;
        
    OnExpire:
        atcommand "@adjgroupid 0";
        end;
}

item_db_usable.yml:

Spoiler

  - Id: 7551
    AegisName: Ticket02
    Name: 6.18 Ticket
    Type: Usable
    Buy: 20
    Weight: 10
    Trade:
      NoDrop: true
      NoTrade: true
      NoCart: true
      NoStorage: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      doevent "vip_group_free::OnSetVIP";

 

4 answers to this question

Recommended Posts

  • 0
Posted

Change

 atcommand "@adjgroupid 5"; >> atcommand "@adjgroup 5";

Also, group_id is not changing in SQL DB because it is temporary until players log out. You can also add this line to check whether the group has changed or not.

dispbottom "Group level "+getgmlevel();

 

  • 0
Posted (edited)
-	script	vip_group_free	-1,{
	OnSetVIP:
		#TEMP_GROUP_V  = gettimetick(2) + (7 * 24 * 60 * 60);//time in seconds
	OnPCLoginEvent:
		if (#TEMP_GROUP_V > gettimetick(2)) {
			if (getgroupid() == 0) {
				query_sql("UPDATE `login` SET `group_id` = 5 WHERE `account_id` = "+getcharid(3));
				atcommand "@adjgroupid 5";
			} 
			.@second = #TEMP_GROUP_V - gettimetick(2);
			addtimer (.@second * 1000), strnpcinfo(3)+"::OnExpire";
			dispbottom "Seu VIP expira em: "+gettimestr("%Y-%m/%d %H:%M:%S",21,#TEMP_GROUP_V);
		}
		end;
		
	OnExpire:
		if (getgroupid() == 5) 
			query_sql("UPDATE `login` SET `group_id` = 0 WHERE `account_id` = "+getcharid(3));
		atcommand "@adjgroupid 0";
		end;
}	

something like this ?

 

perhaps just use the built-in VIP system ? conf\login_athena.conf

// Which group (ID) will be denoted as the VIP group?
// Default: 5
vip_group: 5

 

Edited by Emistry

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...