Jump to content
  • 0

Question

Posted (edited)

hello

i want to make script copy from table to table

 

OnTimer10000:

copy the account_id + str + value

from global_reg_value

and delete them

and make chg in  acc_reg_num

 

edit on the account_id

 

str = key

 

value = {value(global_reg_value)+value(acc_reg_num)}

 

 

or

 

 

set (global_reg_value)account_id = playeracc

 

set (global_reg_value)value = pointsupdate

 

atcommand"#CASHPOINTS "+playeracc" "+pointsupdate;

 

and delete the line in the table or set value(global_reg_value) = 0

 

 

 

 

Is this possible?

Edited by sader1992

4 answers to this question

Recommended Posts

Posted

like this

-	script	update points	-,{
OnPCLoginEvent:
query_sql( "SELECT `account_id`,`value` FROM `global_reg_value` ",.@iduser,.@valueuser );
.idus = .@iduser;
.valueus = .@valueuser;
query_sql("UPDATE `acc_reg_num` SET account_id = '"+.idus+"', key = #CASHPOINTS,  value = (value + '"+.valueus+"')");
query_sql("UPDATE `global_reg_value` SET account_id = 0, key = 0,  value = 0");
end;
}

but there is error~

anyone?

Posted

Hmm maybe

-	script	update points	-1,{
OnPCLoginEvent:
	query_sql "INSERT INTO `acc_reg_num` (`account_id`, `key`, `index`, `value`) select account_id, '#CASHPOINTS', 0, `value` from `global_reg_value` where `account_id` "+
		"= '"+ getcharid(3) +"' on duplicate key update `acc_reg_num`.`value` = `acc_reg_num`.`value` + `global_reg_value`.`value`";
	query_sql "delete from `global_reg_value` where account_id = "+ getcharid(3) +" and `str` = '#CASHPOINTS'";
	end;
}
  • Upvote 1
Posted

 

Hmm maybe

-	script	update points	-1,{
OnPCLoginEvent:
	query_sql "INSERT INTO `acc_reg_num` (`account_id`, `key`, `index`, `value`) select account_id, '#CASHPOINTS', 0, `value` from `global_reg_value` where `account_id` "+
		"= '"+ getcharid(3) +"' on duplicate key update `acc_reg_num`.`value` = `acc_reg_num`.`value` + `global_reg_value`.`value`";
	query_sql "delete from `global_reg_value` where account_id = "+ getcharid(3) +" and `str` = '#CASHPOINTS'";
	end;
}

 

Thank you

it's work Perfect

 

Solved

Posted

Note it should be better to run the sql offline in one go (you save memory)

INSERT INTO `acc_reg_num` (`account_id`, `key`, `index`, `value`) select account_id, '#CASHPOINTS', 0, `value` from `global_reg_value` on duplicate key update `acc_reg_num`.`value` = `acc_reg_num`.`value` + `global_reg_value`.`value`

delete from `global_reg_value` where `str` = '#CASHPOINTS'
  • Upvote 1

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