Jump to content
  • 0

Question reguarding cash points.


sikiro

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  171
  • Reputation:   15
  • Joined:  01/26/12
  • Last Seen:  

i am trying to make this Npc take out cp credits and add them as cash points i am successful at doing it to some extend but when i go to the npc again to just add on to the points it will reset the value.

Example:

i order 1k points reedeem.

then later i order 1k more and redeem.

total points still 1k. i might be missing something supper simple.

prontera,139,182,4	script	Donor Rewards Redeemer	987,{
	// ----------------- NPC Settings -----------------
	// --- SET THESE BEFORE LOADING THE SCRIPT! ---
	
	// Server Name
	set .serverName$,"Stock-RO";
	
	// NPC Name to display during chat.
	// Default: "[Donor Rewards Redeemer]"
	set .npcName$,"[Donor Rewards Redeemer]";
	
	// DO NOT CHANGE THIS!
	// Default: "cp_redeemlog"
	set .redeemTable$,"cp_credits";
	
	// Display Credits to FluxCP Creators?
	// Help promote our product if its useful.
	// 0 = Disable. 1 = Enable.
	// Default: 1
	set .showCredits,0;
	
	// Max number of unique items to redeem at a time.
	// DO NOT RAISE THIS VALUE ABOVE 128 WITHOUT
	// MAKING THE NECESSARY SCRIPT ENGINE MODS
	// FOR SCRIPT ARRAY SIZING! DANGEROUS!
	// Default: 128
	set .numRedemptionsSimul,128; 
	// --------------- End NPC Settings ---------------

	// ----------------- Begin Script -----------------
	mes .npcName$;
	mes "Well hello there " + (Sex ? "good sir!" : "young madam!");
	mes "How may I be of assistance to you on this fine day?";
	next;
	prompt("I wish to redeem items:Who might you be?:I am merely perusing the area");
	mes .npcName$;
switch(@menu) {
		case 1:
			query_sql("SELECT `balance` FROM `" + escape_sql(.redeemTable$) + "` WHERE `account_id` = " + getcharid(3) + " LIMIT 0,30", .@credits);
			if (.@credits > 0){
			mes "How many Donation Credits do you wish to redeem?";
			next;
			mes .npcName$;
			input .@withdrawCredits,1,.@credits;
			query_sql("UPDATE `" + escape_sql(.redeemTable$) + "` SET `balance` = `balance` - " + .@withdrawCredits + " WHERE `account_id` = " + getcharid(3) + "");
			set #CASHPOINTS,.@withdrawCredits;
			mes .@withdrawCredits + "x " ;
			} else {
				mes "My records indicate that there are no rewards awaiting to be redeemed.";
				mes "My deepest apologies for the misunderstanding.";
			}
		break;
		case 2:
			query_sql("SELECT `balance` FROM `" + escape_sql(.redeemTable$) + "` WHERE `account_id` = " + getcharid(3) + " LIMIT 0,30", .@credits);
			mes "You currently have " + .@credits + " donation credits.";
		break;
		case 3:
			mes "I am here to allow for the redemption of donation credits for " + .serverName$ + ".";
			mes "Donations may be made to the server via the control panel.";
		break;
		default:
			mes "Very well then.";
			mes "Good day to you.";
		break;
	}
	close;
	// ------------------ End Script ------------------
}

// ------------ Credits to FluxCP Creators ------------
// - Please do not modify or delete this function or  -
// - its contents. To disable the credits from being  -
// - shown, set .showCredits to 0 in the NPC Settings -
// - at the top of this file.                         -
// ----------------------------------------------------

function	script	F_FluxCredits	{
	mes "-----------------------------------";
	mes "Powered by Flux Control Panel.";
	mes "Copyright © 2008-2012 Matthew Harris and Nikunj Mehta.";
	mes "http://fluxcp.googlecode.com/";
	return;
}

Problem Solved on by tinkering. 

 

Edited by sikiro
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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