sikiro Posted March 27, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Share Posted March 27, 2017 (edited) I do not take credit for this nor did i make this script at all i just modified it. THIS NPC REQUIRES FLUX CONTROL PANEL OR IT WILL NOT WORK. i myself was asking for someone to modify an Npc to be able to accept cash points in game but i also decided it would be ideal to give you both options so it was edited to not only give you the option to redeem cash points but also maintain its core function of allowing a player to still redeem items purchased on the web-store. if you have any questions please feel Free to reply to this topic. Databases required. cp_redeemlog.sql CREATE TABLE IF NOT EXISTS `cp_redeemlog` ( `id` int(11) unsigned NOT NULL auto_increment, `nameid` int(11) unsigned NOT NULL default '0', `quantity` int(11) unsigned NOT NULL default '0', `cost` int(11) unsigned NOT NULL, `account_id` int(11) unsigned NOT NULL, `char_id` int(11) unsigned default NULL, `redeemed` tinyint(1) unsigned NOT NULL, `redemption_date` datetime default NULL, `purchase_date` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM COMMENT='Log of redeemed donation items.'; cp_credits.sql CREATE TABLE IF NOT EXISTS `cp_credits` ( `account_id` int(11) unsigned NOT NULL, `balance` int(11) unsigned NOT NULL DEFAULT '0', `last_donation_date` datetime DEFAULT NULL, `last_donation_amount` float unsigned DEFAULT NULL, PRIMARY KEY (`account_id`), KEY `account_id` (`account_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Donation credits balance for a given account.'; prontera,139,182,4 script Donor Rewards Redeemer 987,{ // ----------------- NPC Settings ----------------- // --- SET THESE BEFORE LOADING THE SCRIPT! --- // Server Name set .serverName$,"rAthena"; // 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"; set .itemTable$,"cp_redeemlog"; // Display Credits to FluxCP Creators? // Help promote our product if its useful. // 0 = Disable. 1 = Enable. // Default: 1 set .showCredits,1; // 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 My Credits:Collect My items :Check my balance."); 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,#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 `id`, `nameid`, `quantity` FROM `" + escape_sql(.itemTable$) + "` WHERE `account_id` = " + getcharid(3) + " AND `redeemed` = 0 LIMIT " + .numRedemptionsSimul,.@id,.@nameid,.@quantity; if (getarraysize(.@id) > 0) { mes "Items Pending Redemption: " + getarraysize(.@id); for (set .@i,0; .@i < getarraysize(.@id); set .@i,.@i+1) if (checkweight(.@nameid[.@i],.@quantity[.@i]) == 0) { mes "I'm terribly sorry, but you are carrying too much to accept " + (.@i ? "any more of " : " ") + "your rewards at this time."; mes "Please come back with fewer items."; } else { query_sql "UPDATE `" + escape_sql(.itemTable$) + "` SET `char_id` = " + getcharid(0) + ", `redeemed` = 1, `redemption_date` = NOW() WHERE `id` = " + .@id[.@i]; getitem .@nameid[.@i],.@quantity[.@i]; mes .@quantity[.@i] + "x " + getitemname(.@nameid[.@i]); } if (.@i == getarraysize(.@id)) { mes "Thank you for your patronage " + (Sex ? "fine sir." : "ma'am."); mes "Please enjoy your stay on " + .serverName$ + "!"; } if (.showCredits) callfunc "F_FluxCredits"; } else { mes "My records indicate that there are no rewards awaiting to be redeemed."; mes "My deepest apologies for the misunderstanding."; } break; case 3: 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; } 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; } donation.txt Edited April 18, 2017 by sikiro 1 Quote Link to comment Share on other sites More sharing options...
Emistry Posted March 28, 2017 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 19 hours ago Share Posted March 28, 2017 your script doesn't provide the required SQL tables that used in the script? Quote Link to comment Share on other sites More sharing options...
sikiro Posted March 28, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted March 28, 2017 this is meant to be used with Flux cp ill edit first post. Quote Link to comment Share on other sites More sharing options...
Cyro Posted March 28, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 1138 Reputation: 290 Joined: 04/29/13 Last Seen: July 20, 2024 Share Posted March 28, 2017 (edited) 12 minutes ago, sikiro said: this is meant to be used with Flux cp ill edit first post. What about cp_reedeemlog table Edited March 28, 2017 by Cyro Quote Link to comment Share on other sites More sharing options...
sikiro Posted March 28, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted March 28, 2017 all tables are part of flux cp if you are using the latest version it should have all of those tables installed by default. Quote Link to comment Share on other sites More sharing options...
Cyro Posted March 28, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 1138 Reputation: 290 Joined: 04/29/13 Last Seen: July 20, 2024 Share Posted March 28, 2017 3 minutes ago, sikiro said: all tables are part of flux cp if you are using the latest version it should have all of those tables installed by default. Okie my bad, my server dont have this table xD Quote Link to comment Share on other sites More sharing options...
sikiro Posted March 28, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted March 28, 2017 then you need to check your schemas on flux cp it should definately have them or else your donation shop on the web will not work properly. Quote Link to comment Share on other sites More sharing options...
Psyche Posted April 14, 2017 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 123 Reputation: 6 Joined: 03/12/13 Last Seen: June 7, 2023 Share Posted April 14, 2017 (edited) Hi, found this error in latest rAthena. npc_parsesrcfile: Detected unsupported UTF-8 BOM in file 'npc/donate.txt'. Stopping (please consider using another character set). Edited April 15, 2017 by Psyche Quote Link to comment Share on other sites More sharing options...
sikiro Posted April 16, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted April 16, 2017 @psyche did you download the file or did you copy it from the text box? Quote Link to comment Share on other sites More sharing options...
Psyche Posted April 18, 2017 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 123 Reputation: 6 Joined: 03/12/13 Last Seen: June 7, 2023 Share Posted April 18, 2017 On 4/17/2017 at 3:04 AM, sikiro said: @psyche did you download the file or did you copy it from the text box? Download sir, Quote Link to comment Share on other sites More sharing options...
sikiro Posted April 18, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted April 18, 2017 i am curently using the script on the latest version of rathena it is working correctly can you show me a picture of your console. please. Quote Link to comment Share on other sites More sharing options...
core Posted May 21, 2017 Group: Members Topic Count: 28 Topics Per Day: 0.01 Content Count: 135 Reputation: 1 Joined: 05/21/17 Last Seen: June 11, 2018 Share Posted May 21, 2017 On 3/27/2017 at 9:08 AM, sikiro said: I do not take credit for this nor did i make this script at all i just modified it. THIS NPC REQUIRES FLUX CONTROL PANEL OR IT WILL NOT WORK. i myself was asking for someone to modify an Npc to be able to accept cash points in game but i also decided it would be ideal to give you both options so it was edited to not only give you the option to redeem cash points but also maintain its core function of allowing a player to still redeem items purchased on the web-store. if you have any questions please feel Free to reply to this topic. Databases required. cp_redeemlog.sql CREATE TABLE IF NOT EXISTS `cp_redeemlog` ( `id` int(11) unsigned NOT NULL auto_increment, `nameid` int(11) unsigned NOT NULL default '0', `quantity` int(11) unsigned NOT NULL default '0', `cost` int(11) unsigned NOT NULL, `account_id` int(11) unsigned NOT NULL, `char_id` int(11) unsigned default NULL, `redeemed` tinyint(1) unsigned NOT NULL, `redemption_date` datetime default NULL, `purchase_date` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM COMMENT='Log of redeemed donation items.'; cp_credits.sql CREATE TABLE IF NOT EXISTS `cp_credits` ( `account_id` int(11) unsigned NOT NULL, `balance` int(11) unsigned NOT NULL DEFAULT '0', `last_donation_date` datetime DEFAULT NULL, `last_donation_amount` float unsigned DEFAULT NULL, PRIMARY KEY (`account_id`), KEY `account_id` (`account_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Donation credits balance for a given account.'; prontera,139,182,4 script Donor Rewards Redeemer 987,{ // ----------------- NPC Settings ----------------- // --- SET THESE BEFORE LOADING THE SCRIPT! --- // Server Name set .serverName$,"rAthena"; // 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"; set .itemTable$,"cp_redeemlog"; // Display Credits to FluxCP Creators? // Help promote our product if its useful. // 0 = Disable. 1 = Enable. // Default: 1 set .showCredits,1; // 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 My Credits:Collect My items :Check my balance."); 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,#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 `id`, `nameid`, `quantity` FROM `" + escape_sql(.itemTable$) + "` WHERE `account_id` = " + getcharid(3) + " AND `redeemed` = 0 LIMIT " + .numRedemptionsSimul,.@id,.@nameid,.@quantity; if (getarraysize(.@id) > 0) { mes "Items Pending Redemption: " + getarraysize(.@id); for (set .@i,0; .@i < getarraysize(.@id); set .@i,.@i+1) if (checkweight(.@nameid[.@i],.@quantity[.@i]) == 0) { mes "I'm terribly sorry, but you are carrying too much to accept " + (.@i ? "any more of " : " ") + "your rewards at this time."; mes "Please come back with fewer items."; } else { query_sql "UPDATE `" + escape_sql(.itemTable$) + "` SET `char_id` = " + getcharid(0) + ", `redeemed` = 1, `redemption_date` = NOW() WHERE `id` = " + .@id[.@i]; getitem .@nameid[.@i],.@quantity[.@i]; mes .@quantity[.@i] + "x " + getitemname(.@nameid[.@i]); } if (.@i == getarraysize(.@id)) { mes "Thank you for your patronage " + (Sex ? "fine sir." : "ma'am."); mes "Please enjoy your stay on " + .serverName$ + "!"; } if (.showCredits) callfunc "F_FluxCredits"; } else { mes "My records indicate that there are no rewards awaiting to be redeemed."; mes "My deepest apologies for the misunderstanding."; } break; case 3: 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; } 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; } donation.txt hi any vid tutorial or guides how to encode it Quote Link to comment Share on other sites More sharing options...
sikiro Posted May 21, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 171 Reputation: 16 Joined: 01/26/12 Last Seen: January 1, 2024 Author Share Posted May 21, 2017 what do do you want to encode? this npc works directly with flux cp so you get the secirity it provides. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.