Jump to content

Question

Posted
// Original Script by Ahmad
// RAO Dungeon
prontera,161,193,5	script	RAO Dungeon	406,{
	mes "[RAO Dungeon]";
	mes "Hm...?";
	mes "Are you sure want to enter Dungeon?";
	mes "You need 1 Ticket Dungeon,"; 
	mes "and PVP Allowed in this map,";
	next;
	mes "[RAO Dungeon]";	
	mes "You must care, and be better you"; 
	mes "Enter Dungeon with your party.";
	next;
	mes "[RAO Dungeon]";	
	mes "You can request 3 ticket everyday,";
	mes "And reset every 06.00am.";
	next;
	switch(select("Request Ticket:Dungeon Lv60-80:Dungeon Lv81-100:Dungeon Lv101-120:Cancel")) {

	case 1:
		if ( !query_sql( "SELECT `account_id` FROM `daily_reward` WHERE `account_id` ="+ getcharid(3) , .@acc ) ) {
			getitem 21000,3;
			dispbottom "Gained 3 RAO Instance Ticket.";
			query_sql "insert into `daily_reward` values ( "+getcharid(3)+" )";
			} else {
		mes "[RAO Dungeon]";
		mes "You wait must until reset.";
		mes "at 06.00am.";
		}
		close2;
		break;
	
	case 2:
		if ( countitem(21000) >= 1  && BaseLevel >= 60 && BaseLevel <= 80) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "80@RAO_in",104,250;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}
		close2;
		break;

	case 3:
		if ( countitem(21000) >= 1  && BaseLevel >= 81 && BaseLevel <= 100) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "100@RAO_in",141,184;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 4:
		if ( countitem(21000) >= 1  && BaseLevel >= 101 && BaseLevel <= 120) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "120@RAO_in",243,46;		
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 5:
		close2;
		break;		
	}
	
OnHour06:
	query_sql "truncate daily_reward";
	end;

}

Can someone checkit? its not work in case 1: i dunno it never check sql dail_reward is empty, and never insert account id in daily_reward @@, sorry bad eng >.<

10 answers to this question

Recommended Posts

Posted
// Original Script by Ahmad
// RAO Dungeon
prontera,161,193,5	script	RAO Dungeon	406,{
	mes "[RAO Dungeon]";
	mes "Hm...?";
	mes "Are you sure want to enter Dungeon?";
	mes "You need 1 Ticket Dungeon,"; 
	mes "and PVP Allowed in this map,";
	next;
	mes "[RAO Dungeon]";	
	mes "You must care, and be better you"; 
	mes "Enter Dungeon with your party.";
	next;
	mes "[RAO Dungeon]";	
	mes "You can request 3 ticket everyday,";
	mes "And reset every 06.00am.";
	next;
	switch(select("Request Ticket:Dungeon Lv60-80:Dungeon Lv81-100:Dungeon Lv101-120:Cancel")) {

	case 1:
		if ( !query_sql( "SELECT `account_id` FROM `daily_reward` WHERE `account_id` ="+ getcharid(3) , .@acc ) ) {
			getitem 21000,3;
			dispbottom "Gained 3 RAO Instance Ticket.";
			query_sql "insert into `daily_reward` values ( "+getcharid(3)+" )";
			} else {
		mes "[RAO Dungeon]";
		mes "You wait must until reset.";
		mes "at 06.00am.";
		}
		close2;
		break;
	
	case 2:
		if ( countitem(21000) >= 1  && BaseLevel >= 60 && BaseLevel <= 80) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "80@RAO_in",104,250;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}
		close2;
		break;

	case 3:
		if ( countitem(21000) >= 1  && BaseLevel >= 81 && BaseLevel <= 100) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "100@RAO_in",141,184;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 4:
		if ( countitem(21000) >= 1  && BaseLevel >= 101 && BaseLevel <= 120) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "120@RAO_in",243,46;		
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 5:
		close2;
		break;		
	}
	
OnHour06:
	query_sql "truncate daily_reward";
	end;

}

Can someone checkit? its not work in case 1: i dunno it never check sql dail_reward is empty, and never insert account id in daily_reward @@, sorry bad eng >.<

 

 

can you be more specific? error at you console?

Posted

 

// Original Script by Ahmad
// RAO Dungeon
prontera,161,193,5	script	RAO Dungeon	406,{
	mes "[RAO Dungeon]";
	mes "Hm...?";
	mes "Are you sure want to enter Dungeon?";
	mes "You need 1 Ticket Dungeon,"; 
	mes "and PVP Allowed in this map,";
	next;
	mes "[RAO Dungeon]";	
	mes "You must care, and be better you"; 
	mes "Enter Dungeon with your party.";
	next;
	mes "[RAO Dungeon]";	
	mes "You can request 3 ticket everyday,";
	mes "And reset every 06.00am.";
	next;
	switch(select("Request Ticket:Dungeon Lv60-80:Dungeon Lv81-100:Dungeon Lv101-120:Cancel")) {

	case 1:
		if ( !query_sql( "SELECT `account_id` FROM `daily_reward` WHERE `account_id` ="+ getcharid(3) , .@acc ) ) {
			getitem 21000,3;
			dispbottom "Gained 3 RAO Instance Ticket.";
			query_sql "insert into `daily_reward` values ( "+getcharid(3)+" )";
			} else {
		mes "[RAO Dungeon]";
		mes "You wait must until reset.";
		mes "at 06.00am.";
		}
		close2;
		break;
	
	case 2:
		if ( countitem(21000) >= 1  && BaseLevel >= 60 && BaseLevel <= 80) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "80@RAO_in",104,250;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}
		close2;
		break;

	case 3:
		if ( countitem(21000) >= 1  && BaseLevel >= 81 && BaseLevel <= 100) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "100@RAO_in",141,184;
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 4:
		if ( countitem(21000) >= 1  && BaseLevel >= 101 && BaseLevel <= 120) {	
		mes "[RAO Dungeon]";
		mes "I Hope you enjoyed!.";
		next;
		warp "120@RAO_in",243,46;		
		delitem 21000,1;
		} else {
		mes "[RAO Dungeon]";
		mes "Only Lv60-80 can enter Dungeon.";
		mes "And you need 1 Ticket.";
		}	
		close2;
		break;

	case 5:
		close2;
		break;		
	}
	
OnHour06:
	query_sql "truncate daily_reward";
	end;

}

Can someone checkit? its not work in case 1: i dunno it never check sql dail_reward is empty, and never insert account id in daily_reward @@, sorry bad eng >.<

 

 

can you be more specific? error at you console?

 

 

its not error, without error, but scirpt in case 1 not work, dunnow, never insert query_sql "insert into `daily_reward` values ( "+getcharid(3)+" )"; and never read if ( !query_sql( "SELECT `account_id` FROM `daily_reward` WHERE `account_id` ="+ getcharid(3) , .@acc )

Posted

That is because query_sql on rAthena doesn't return 0 if no elements are found, therefore your statement is always false. You should write it as the following :

query_sql("SELECT count(*) FROM `daily_reward` WHERE `account_id` = '" + getcharid(3) + "'", .@count);

if (.@count > 0) {
	mes "[RAO Dungeon]";
	mes "You must wait until reset.";
	mes "at 06.00am.";
} else {
	getitem 21000,3;
	dispbottom "Gained 3 RAO Instance Ticket.";
	query_sql("INSERT INTO `daily_reward` SET `account_id` = '" + getcharid(3) + "'");
}
close2;
Posted (edited)

 

That is because query_sql on rAthena doesn't return 0 if no elements are found, therefore your statement is always false. You should write it as the following :

query_sql("SELECT count(*) FROM `daily_reward` WHERE `account_id` = '" + getcharid(3) + "'", .@count);

if (.@count > 0) {
	mes "[RAO Dungeon]";
	mes "You must wait until reset.";
	mes "at 06.00am.";
} else {
	getitem 21000,3;
	dispbottom "Gained 3 RAO Instance Ticket.";
	query_sql("INSERT INTO `daily_reward` SET `account_id` = '" + getcharid(3) + "'");
}
close2;

 

still not working sir, btw how about with this line too? hmm

 

OnHour06:

    query_sql "truncate daily_reward";

    end;

 

??

Edited by AHMADSHIDQI
Posted

The script I posted above is working fine on my end (truncate too), check your console logs and tell us the issues you're having, if any. Check if the lines have been added in your SQL table as well.

Posted

The script I posted above is working fine on my end (truncate too), check your console logs and tell us the issues you're having, if any. Check if the lines have been added in your SQL table as well.

 

can u share your tables of daily_reward? hmm

Posted (edited)

I've set up my daily_reward table as follow :

CREATE TABLE IF NOT EXISTS `daily_reward` (
  `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`account_id`)
) ENGINE=MyISAM;

That... won't help you much though, does your console show nothing? Try a one-liner script, with an insert query and dummy values. If nothing shows up in your table, then you didn't create it properly or something else is going on. (The console would tell you about such error though...!)

Edited by Tokei
Posted (edited)

I've set up my daily_reward table as follow :

CREATE TABLE IF NOT EXISTS `daily_reward` (
  `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`account_id`)
) ENGINE=MyISAM;

That... won't help you much though, does your console show nothing? Try a one-liner script, with an insert query and dummy values. If nothing shows up in your table, then you didn't create it properly or something else is going on. (The console would tell you about such error though...!)

 

i already test but still same @@, always never insert sql to daily_reward table @@

Edited by AHMADSHIDQI
Posted

Copy paste your console output, or at least show us a screenshot of it. Your error is probably written there in plain sight...

 

 

i dunnow sir, but in console no shown warning error sql or something, but the  script still not work x_x, never insert sql to daily_reward, but still no warning x_x

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