Jump to content

Recommended Posts

  • 2 weeks later...
Posted

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~

 

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...