Jump to content
  • 0
Sign in to follow this  
chiba222

OnHour00 player's value recover

Question

Hi everyone,

Can anyone tell me how to change a player's value when using OnHour00?

My script is every player they have a value called "M_point", if OnHour00, "M_Point" will be recever to 3.

Thank you.

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0

you know what ?

I'm going to show you the simplest way how to do this

Spoiler

function	script	F_today	{
	return atoi( gettimestr( "%Y%m%d", 9 ) );
}
prontera,162,185,3	script	VIPservice	1_F_MARIA,{
	mes "[VIPservice]";
	mes "Everyday only allow to buy 1 time";
	next;
	switch( select( "Exp rate x3", "Drop rate x3", "Cancel" ) ) {
	case 1:
		if ( callfunc("F_today") == buyexp ) {
			mes "[VIPservice]";
			mes "You have reached the purchasee limited";
			mes "Please try it tomorrow.";
			close;
		}
		buyexp = callfunc("F_today");
		mes "Done. Enjoy your Exp rate x3";
		sc_start SC_CASH_PLUSEXP, 30*60*1000, 300;
		close;
	case 2:
		if ( callfunc("F_today") == buydrop ) {
			mes "[VIPservice]";
			mes "You have reached the purchasee limited";
			mes "Please try it tomorrow.";
		close;
		}
		buydrop = callfunc("F_today");
		mes "Done. Enjoy your Drop rate x3";
		sc_start SC_CASH_RECEIVEITEM, 30*60*1000, 300;
		close;
	default:
	}
	close;
}

 

abuse the battle manual and bubble gum cash item status
https://github.com/HerculesWS/Hercules/blob/master/db/sc_config.txt#L162
93 = 64+16+8+4+1
= cannot be dispel, doesn't remove on death, persist after logout ...

PLUS ++
it also show the status icon on the client
post-4102-0-46621600-1450923436_thumb.jpg

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

hmm ... I can't search on rathena forum ... stupid ... seriously rathena should fix their advance search engine

nvm, write a new one ...

function	script	F_today	{	return atoi( gettimestr("%Y%m%d", 9) );}prontera,155,185,5	script	I Hate Doctor	1_F_MARIA,{	if ( callfunc("F_today") == last_apple_taken ) {		mes "you already receive an apple";		close;	}	mes "an apple a day, kick the doctor away";	getitem Apple, 1;	last_apple_taken = callfunc("F_today");	close;}
thx to emistry

 

some server out there uses gettime(GETTIME_DAYOFYEAR), which is gettime(8) to track

I still prefer to save in date format so I can see the value in the sql

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

out of curiosity ...

 

@Annie

return atoi( gettime(GETTIME_YEAR) + gettimestr("%m%d", 5) );

why not use this?

return atoi( gettimestr("%Y%m%d", 9) );

any drawback ??

Share this post


Link to post
Share on other sites
  • 0

out of curiosity ...

 

@Annie

return atoi( gettime(GETTIME_YEAR) + gettimestr("%m%d", 5) );
why not use this?
return atoi( gettimestr("%Y%m%d", 9) );
any drawback ??

 

 

server crash when compile under MSVC

https://www.eathena.ws/board/index.php?s=&showtopic=272409&view=findpost&p=1492260

credit to brian for the info

 

LOL

I read the topic again, its gettime(3) not gettime(7)

 

HAHAHA !!!

http://herc.ws/wiki/Gettimestr

%Y is not in the example, time for update that 8 years old script

Share this post


Link to post
Share on other sites
  • 0

prontera,155,185,5	script	kdjsfskfh	1_F_MARIA,{   dispbottom gettimestr("%l:%M %p",10);}
my test server crash
---------------------------Microsoft Visual C++ Debug Library---------------------------Debug Assertion Failed!Program: D:RagnarokHerculesmap-server.exeFile: f:ddvctoolscrt_bldself_x86crtsrcstrftime.cLine: 798Expression: ( "Invalid format directive" , 0 )For information on how your program can cause an assertionfailure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)---------------------------Abort   Retry   Ignore   ---------------------------
.

.

if compile under linux or cygwin, the %l should be Hour(1~12) format

my test server compile under microsoft visual studio crash on this format, can only use %H

 

%M is minute(00-59)

%p is AM-PM

 

I already update the wiki

http://herc.ws/wiki/index.php?title=Gettimestr

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

@@Angelmelody

all right I open an issue in github

https://github.com/HerculesWS/Hercules/issues/1006

 

@@chiba222

EDITED: the full script already posted on post#2 isn't it ?

 

Yes, but can you make it automatically that players can receive "point" or "item" at 00:00?

Because I don't know which commands to make it automatically.

I use it as an invisible NPC and reset everything.

Like:

set buyVIP, 0;

set M_Point, 3;

Thank you.

Share this post


Link to post
Share on other sites
  • 0

set buyVIP, 0;
and what is this mean ?

you never say anything about VIP in your post

 

also, its bad idea to give items automatically in utility script

 

event script is 1 thing, since players usually under 90% weight (to whack monsters/pvp), thus can skip the *checkweight check

but in utility script has to use *checkweight script command every time

 

if you give items to player automatically at certain time without any notification,

like just give 10 berry at 12am automatically,

if the player at the time are adjusting equipment, using storage, ... etc

and caused overweight, the item will fall on the floor

 

 

EDIT: you should describe more about this variable

set M_Point, 3;
where you use it ?

why it increase ?

why you want it reset ?

does it affect to all players or just VIP ?

 

seriously I regret reply the kind of post where it doesn't describe everything properly

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

 

set buyVIP, 0;
and what is this mean ?

you never say anything about VIP in your post

 

also, its bad idea to give items automatically in utility script

 

event script is 1 thing, since players usually under 90% weight (to whack monsters/pvp), thus can skip the *checkweight check

but in utility script has to use *checkweight script command every time

 

if you give items to player automatically at certain time without any notification,

like just give 10 berry at 12am automatically,

if the player at the time are adjusting equipment, using storage, ... etc

and caused overweight, the item will fall on the floor

Sorry my post was unclear.

The first time I only say M_point because I think I can add the rest by myself.

Thanks for notice me about giving items to player automatically.

 

My whole script is only use for restart player's var.

In my script there are "M_point" and "buyVIP",

These var will be recover to 3(M_point) and 0(buyVIP) at 00:00 automatically.

Thank you.

Share this post


Link to post
Share on other sites
  • 0

-	script	asdf	1_F_MARIA,{OnClock0000:	getmemberaid ALL_CLIENT;	for ( .@i = 0; .@i < $@onlinecount; ++.@i ) {		attachrid $@onlineaid[.@i];		M_point = 3;		buyVIP = 0;	}	query_sql "update char_reg_num_db set `value` = 3 where `key` = 'M_point'";	query_sql "insert ignore into char_reg_num_db select char_id, 'M_point', 0, 3 from `char` where account_id != 1";	query_sql "delete from char_reg_num_db where `key` = 'buyVIP'";	end;}
you should know this kind of script is performance killer script

 

unless you really tell how that "M_point" and "buyVIP" come from,

then you can stick to this script that lags every time it runs

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

 

-	script	asdf	1_F_MARIA,{OnClock0000:	getmemberaid ALL_CLIENT;	for ( .@i = 0; .@i < $@onlinecount; ++.@i ) {		attachrid $@onlineaid[.@i];		M_point = 3;		buyVIP = 0;	}	query_sql "update char_reg_num_db set `value` = 3 where `key` = 'M_point'";	query_sql "insert ignore into char_reg_num_db select char_id, 'M_point', 0, 3 from `char` where account_id != 1";	query_sql "delete from char_reg_num_db where `key` = 'buyVIP'";	end;}
you should know this kind of script is performance killer script

 

unless you really tell how that "M_point" and "buyVIP" come from,

then you can stick to this script that lags every time it runs

 

Thank you.

The "M_point" will be decrease by 1 if player go to the dungeon.

I have limited the time as 3. So player only allow to go to the dungeon 3 times a day.

After 00:00, the "M_point" recover to 3.

 

The "buyVIP" is limited player to buy VIP service.

Each time player buy the VIP service, "buyVIP' will be increase to 1.

If "buyVIP" is 1, player cannot buy VIP service anymore.

After 00:00, the "buyVIP' decrease to 0. So player allow to buy VIP service again.

Here is the whole script, please check.

VIPservice

Share this post


Link to post
Share on other sites
  • 0

 

you know what ?

I'm going to show you the simplest way how to do this

function	script	F_today	{	return atoi( gettimestr( "%Y%m%d", 9 ) );}prontera,162,185,3	script	VIPservice	1_F_MARIA,{	mes "[VIPservice]";	mes "Everyday only allow to buy 1 time";	next;	switch( select( "Exp rate x3", "Drop rate x3", "Cancel" ) ) {	case 1:		if ( callfunc("F_today") == buyexp ) {			mes "[VIPservice]";			mes "You have reached the purchasee limited";			mes "Please try it tomorrow.";			close;		}		buyexp = callfunc("F_today");		mes "Done. Enjoy your Exp rate x3";		sc_start SC_CASH_PLUSEXP, 30*60*1000, 300;		close;	case 2:		if ( callfunc("F_today") == buydrop ) {			mes "[VIPservice]";			mes "You have reached the purchasee limited";			mes "Please try it tomorrow.";			close;		}		buydrop = callfunc("F_today");		mes "Done. Enjoy your Drop rate x3";		sc_start SC_CASH_RECEIVEITEM, 30*60*1000, 300;		close;	default:	}	close;}
abuse the battle manual and bubble gum cash item status

https://github.com/HerculesWS/Hercules/blob/master/db/sc_config.txt#L162

93 = 64+16+8+4+1

= cannot be dispel, doesn't remove on death, persist after logout ...

 

PLUS ++

it also show the status icon on the client

attachicon.gifscreenRuru_Server041.jpg

Thank you so much!

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.