Jump to content
  • 0
Radian

Having Issue with a script

Question

Hey guys, while I was checking a script i noticed that I cant exchange my points it keeps saying this part mes "You don't have enough points to exchange.";

This is the part of the script, I got 15 points from my mysql.

		if(select("Exchange my points into coins:Cancel")==2) close;
		if(!query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS))
			@WA_POINTS = 0;
		mes "[ ^04B4AEAvery^000000 ]";
		if(@WA_POINTS < [email protected]_WP)
			mes "You don't have enough points to exchange.";
		else {
			mes "You currently have ^0000aa"+@WA_POINTS+"^000000 points. How much would you exchange?";
			input .@cb,[email protected]_WP,@WA_POINTS;
			if(.@cb > @WA_POINTS) {
				mes "You want to exchange too much points.";
			} else {
				.@div = .@cb / [email protected]_WP;
				getitem 32609,.@div;
				.@reste = .@cb - (.@cb % [email protected]_WP);
				if((@WA_POINTS - .@reste) <= 0) {
					query_sql("DELETE FROM `wicked_ladder` WHERE `char_id` = '"+getcharid(0)+"'");
				} else {
					query_sql("UPDATE `wicked_ladder` SET `points` = '"+(@WA_POINTS - .@reste)+"' WHERE `char_id` = "+getcharid(0)+"");
				}
				mes "^00af00You got "+.@div+" Wicked Coin(s).^000000";
			}
		}

No map error at all.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
58 minutes ago, Radian said:

Hey guys, while I was checking a script i noticed that I cant exchange my points it keeps saying this part mes "You don't have enough points to exchange.";

This is the part of the script, I got 15 points from my mysql.

No map error at all.

At some point query_sql was changed to return -1 instead of zero when failing.

if(!query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS))

Should be

if(query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS) <= 0)

I can't say that will fix your problem for sure though. Make sure your database is correct.

Link to comment
Share on other sites

  • 0
10 minutes ago, Skorm said:

At some point query_sql was changed to return -1 instead of zero when failing.

if(!query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS))

Should be

if(query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS) <= 0)

I can't say that will fix your problem for sure though. Make sure your database is correct.

I'll run a test on your suggestion..

 

Edit -- 

I still got the same result, And as you mention i checked the database and it is correct. for the other npc it is working

at this part

	case 1:
		if(@WA_POINTS < 1 || !query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id`="+getcharid(0)+"",@WA_POINTS)) {
			mes "[ ^04B4AEArena Helper^000000 ]";
			mes "I required ^0000ff1WP^000000 for this service. Im sorry.";
		} else {			
			if((@WA_POINTS - 1) <= 0) {
				query_sql("DELETE FROM `wicked_ladder` WHERE `char_id` = '"+getcharid(0)+"'");
			} else {
				query_sql("UPDATE `wicked_ladder` SET `points` = '"+(@WA_POINTS - 1)+"' WHERE `char_id` = "+getcharid(0)+"");
			}
			skilleffect 28,2000;
			percentheal 100,100;
		}

 

Edited by Radian
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...

Important Information

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