Jump to content

Hourly Bonus


themon

Recommended Posts


  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  240
  • Reputation:   40
  • Joined:  04/27/13
  • Last Seen:  

User will get their Daily Hourly Bonus by every hour

http://www.mediafire.com/?41ody4opst2ipzr

hourlybonus.txt

hourlybonus Array Version.txt

Edited by themon
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

Ok there are a few things about your script id like to advise you on,

 

Firstly

You use $DLogin , which is a global variable, once one person claims rewards no one else on server will be able to till following day

Instead try using an account variable #DLogin and using an sql data wipe at 00:00 like so

 OnClock0000:
    set $DLogin,0;
    query_sql("DELETE FROM `global_reg_value` WHERE `str` = '#DLogin'");
    set .@size, query_sql("select account_id from `char` where online = 1", .@aid);
    for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
        if(attachrid(.@aid[.@i])){
            set #DLogin,0;
        }    
    }
    Announce "You can now claim your Daily Bonus!",8;
end;

 

 

 

Secondly

Don't use goto, goto goto for the same code with a variable difference, instead make the script dynamic using arrays

example

	if(#DLogin == 1){
		mes "You had already received your gift today.";
		mes "Please! come back again tomorrow.";
		emotion e_bzz;
		close;
	}
	mes "Im glad to give you your Daily Bonus!";
	next;
	switch(rand(5)){ // 1/rand will be items, rest will be zeny
		case 0: //Items
			//		Card,	Enchant,	Healing,	All items
			setarray .@Plow, 4001,	4700,		401,		501;
			setarray .@Phigh,4555,	4871,		599,		21005;
                        set .@x, rand(getarraysize(.Plow));
                        set .@p, rand(.Plow[.@x],.PHigh[.@x]);
                        while(getitemname(.@p) == "null"){
                            set .@p, rand(.Plow[.@x],.PHigh[.@x]);
                        }
                        if (checkweight(@claim,1) == 0 ){
                            mes "Sorry you are overweight!";
                            emotion e_bzz;
                            close;
                        }
			getitem .@p,1;
			Announce "" + strcharinfo(0) + " got " + getitemname(.@p) + "",8;	
		break;
		default: //Zeny
			setarray .@x,5,10,50,100,500,1000,5000,100000,1000000;
			set .@p, .@x[rand(getarraysize(.@x))] * rand(1,50);
			set Zeny,zeny + .@p;
			Announce "" + strcharinfo(0) + " got " + .@p + "z!",8;
		break;
	}
	emotion e_thx;
	set #DLogin,1;
	close;

 

Hope this helps~

 

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  240
  • Reputation:   40
  • Joined:  04/27/13
  • Last Seen:  

Ok thanks for the advice

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
Reply to this topic...

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