Dori Posted October 10, 2016 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Share Posted October 10, 2016 (edited) 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 October 10, 2016 by Emistry removed db link. Quote Link to comment Share on other sites More sharing options...
0 Sryx Posted October 10, 2016 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 520 Reputation: 64 Joined: 11/19/11 Last Seen: October 19, 2024 Share Posted October 10, 2016 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; } } Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted October 11, 2016 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 13 hours ago Share Posted October 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
Question
Dori
I'm trying to make a quest account bound, but not quite sure how to properly update the sql side of this.
Edited by Emistrywhat 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!
removed db link.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.