Jump to content
  • 0

Please check it


AHMADSHIDQI

Question


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

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

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  387
  • Reputation:   60
  • Joined:  10/08/13
  • Last Seen:  

// 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?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

 

// 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 )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  668
  • Reputation:   677
  • Joined:  11/12/12
  • Last Seen:  

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;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

 

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  668
  • Reputation:   677
  • Joined:  11/12/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  668
  • Reputation:   677
  • Joined:  11/12/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  668
  • Reputation:   677
  • Joined:  11/12/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  64
  • Reputation:   1
  • Joined:  02/18/12
  • Last Seen:  

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

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