Jump to content
  • 0

How to reset value in Table: acc_reg_num within scripts on selected time? (SOLVED)


rakuzas

Question


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  459
  • Reputation:   7
  • Joined:  06/29/12
  • Last Seen:  

Hello,

I want to make Stock Scripts Reset all player stock on 00:00 hour.. 


Below is my current example script : 

 

OnClock0951: 
	query_sql "delete from `acc_reg_num` where `key` = '#S1'";
	query_sql "delete from `acc_reg_num` where `key` = '#S2'";
	query_sql "delete from `acc_reg_num` where `key` = '#S3'";
	query_sql "delete from `acc_reg_num` where `key` = '#S4'";
	query_sql "delete from `acc_reg_num` where `key` = '#S5'";
	query_sql "delete from `acc_reg_num` where `key` = '#S6'";
	query_sql "delete from `acc_reg_num` where `key` = '#S7'";
	query_sql "delete from `acc_reg_num` where `key` = '#S8'";
	query_sql "delete from `acc_reg_num` where `key` = '#S9'";
	query_sql "delete from `acc_reg_num` where `key` = '#S10'";
	announce "[Stock Market] Our stock has been reset!",bc_all,0xFF0000;
	set $S_LastUpd$,"12:00";
	goto S_Fluc;
	end;

My current scripts sometimes make the map-server.exe broken/crash.. Not sure why..
Also, player who not relog.. Still can sell their current Stock.. And when ONLY IF they relog, the stock will be reset.. 

Already tried many ways.. But still somehow stuck.. Hope can get any guides.. Thank you..

Edited by rakuzas
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 2

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

OnClock0951: 
	donpcevent strnpcinfo(3)+"::OnResetStock";
	announce "[Stock Market] Our stock has been reset!",bc_all,0xFF0000;
	set $S_LastUpd$,"12:00";
	goto S_Fluc;
	end;
	
OnResetStock:
	query_sql "DELETE FROM `acc_reg_num` WHERE `key` LIKE '#S%'";
	addrid(0);
	for (.@i = 1; .@i <= 10; .@i++) {
		setd("#S"+.@i, 0);
	}
	// dispbottom "Stock has reset.";
	end;

you can try something like this..... remove from SQL + attach online player and clear their variables.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  459
  • Reputation:   7
  • Joined:  06/29/12
  • Last Seen:  

Thanks.. So far it does not crashing my map-server.exe with your script.. 

But when check stock, it still shows up old stock data value.. When I buy BTC 100x it calculate with older stock data.. But I guess this is not a big deal since it solved when player relog.. 

5a0d0bad2210f_notclear.png.a25adda24eb6f71fe007093b0d53183e.png

Thank you Emistry for helping me out.. ^_^/no1 

Edited by rakuzas
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  12/16/17
  • Last Seen:  

prontera,156,185,6	script	kdsjfhsdkfs	100,{
	mes "blah";
	next;
	if ( select( "Show me Top 7 highest Zeny", "Show me Top 5 highest Cash Points", "Show me Top 10 Gold Coin holder" ) == 1 ) {
		.@nb = query_sql( "select name, zeny from `char` left join login on `char`.account_id = login.account_id where group_id < 10 order by zeny desc limit 7", .@name$, .@zeny );
		for ( .@i = 0; .@i < .@nb; .@i++ )
			mes .@name$[.@i] +" - "+ .@zeny[.@i] +"Z";
	}
	else if ( @menu == 2 ) {
		.@nb = query_sql( "select name, value from `char` left join global_reg_value on `char`.account_id = global_reg_value.account_id left join login on `char`.account_id = login.account_id where global_reg_value.str = '#CASHPOINTS' and group_id < 10 group by `char`.account_id order by cast( value as signed ) desc limit 5;", .@name$, .@cash );
		for ( .@i = 0; .@i < .@nb; .@i++ )
			mes .@name$[.@i] +" - "+ .@cash[.@i] +" points.";
	}
	else {
		.@nb = query_sql( "select name, amount from inventory left join `char` on inventory.char_id = `char`.char_id left join login on `char`.account_id = login.account_id where nameid = 671 and group_id < 10 order by amount desc limit 10", .@name$, .@amount );
		for ( .@i = 0; .@i < .@nb; .@i++ )
			mes .@name$[.@i] +" - "+ .@amount[.@i] +" gold coins.";
	}
	close;
}

 

i need use this script but can use only show top zeny

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