Jump to content
  • 0

applying to the whole account (SQL)


Dori

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

I'm trying to make a quest account bound, but not quite sure how to properly update the sql side of this.
 
what i want to do is to find the following variable on all players and make it apply to the whole account.
 
petquest  to #petquest
 
but the 'petquest' is saved in char_reg_num
 
I need to change it to #petquest and move it to acc_reg_num
 
I'm not sure how to run this on sql. Any help is appreciated!

Edited by Emistry
removed db link.
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  520
  • Reputation:   64
  • Joined:  11/19/11
  • Last Seen:  

Do it using OnPCLogintEvent, haven't tried this hope it works.

 

First query it will check if the character have the petrequest.

Second query will delete data on char_reg_num.

Next line it will set the #petrequest to 1.

-		script	transfer	-1,{
	OnPCLoginEvent:
		query_sql ("SELECT `char_id` FROM `char_reg_num` WHERE `char_id`= '" + getcharid(0) + "' and `key` = 'petquest'", .@char_id$);
		if(.@char_id$ != ""){
			query_sql ("DELETE FROM `char_reg_num` WHERE `char_id`= '" + getcharid(0) + "' and `key` = 'petquest'");
			set #petquest , 1;
			end;
		}
}
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

well, there are some better way by using SQL Query ... something like...

INSERT INTO àccount_table ( column1,column2 ) VALUES 
SELECT variable,value FROM char_table WHERE variable LIKE 'petquest' 

but since account table save account_id and not char_id, you need some trick like "JOIN TABLE" to update with correct value..

 
for beginner / most easier way ....

OnPCLoginEvent:
    if ( petquest ) {
        #petquest = petquest;
        petquest = 0;
    }
    end;

@sryx

you method are abit wrong here, the char variable will be "re-added" when he server save the char/updating the variable.

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...