JayPee Posted March 24, 2012 Share Posted March 24, 2012 Script Name: FluxCP V4P NPC Description: This is the npc script for my FluxCP V4P. Version: 1.0 Function: add_item(ITEMID,QUANTITY,VOTEPOINTS,"CATEGORY"); REQUIREMENTS: You must have this: http://rathena.org/b...ote-for-points/ Parameters(should be in order): ITEMID - the itemid to give QUANTITY - how many will be given VOTEPOINTS - how many points needed CATEGORY - on what category you want it to be belong rAthena Version: //==================================================================================== //Script Name: Vote For Points NPC Script for FluxCP //SVN: Tested in rAthena r156513 //Developed By: JayPee Mateo //Version: 1.0 //Requirement(s): FluxCP V4P Addon //Description: This is a npc script for FluxCP Vote for points in order for the players //to claim their vote points //==================================================================================== royal_room3,80,136,5 script VoteForPoints 89,{ //Function Prototypes function garbagecol;//Garbage collection for the Character variables garbagecol(); function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY); function makeCategory;//This will return a list of the categories function getItemsByCat;//This will return the list of items associated to the particular category function getItemDetails;//This will return the details of the item function getPoints;//This will return the points of the player stored in the database function updatePoints;//This will updates the points of the player stored in the database //NPC Name set .npcname$,"[ Vote For Points ]"; //Initialization of the Rewards add_item(555,1,100,"Hello"); add_item(556,2,101,"Hello"); add_item(557,3,101,"Hello1"); //Script Start mes .npcname$; mes "Hi! Do you want to exchange your vote points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set [email protected],select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set [email protected],select(getItemsByCat(@listCat$[[email protected]]))-1; next; mes .npcname$; set [email protected],getItemDetails(@itemKeys[[email protected]],"itemid"); set [email protected],getItemDetails(@itemKeys[[email protected]],"quantity"); set [email protected],getItemDetails(@itemKeys[[email protected]],"points"); mes "Item ID:"[email protected]; mes "Item Name: "+getitemname([email protected]); mes "Item Quantity: "[email protected]+" pc(s)."; mes "Required Points: "[email protected]+" pt(s)."; mes "n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set [email protected],getPoints(getcharid(3)); if([email protected]>[email protected]) { next; mes .npcname$; updatePoints(getcharid(3),[email protected]); getitem [email protected],[email protected]; mes "Here you go!. Thank you for voting. Don't forget to vote again. "; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set [email protected],getPoints(getcharid(3)); mes "You currently have "[email protected]+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set [email protected]_id,getarg(0); set [email protected],getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"[email protected]+") WHERE account_id='"[email protected]_id+"'"); return; } function getPoints { set [email protected]_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="[email protected]_id+" LIMIT 1",[email protected]); if(getarraysize([email protected])==0) return 0; return [email protected][0]; } function getItemDetails { set [email protected],getarg(0); //Key set [email protected]$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower([email protected]$) == strtolower("ItemID")) return @itemID[[email protected]]; else if(strtolower([email protected]$) == strtolower("Quantity")) return @itemQ[[email protected]]; else if(strtolower([email protected]$) == strtolower("Points")) return @points[[email protected]]; else if(strtolower([email protected]$) == strtolower("Category")) return @category$[[email protected]]; } function getItemsByCat { set [email protected]$,getarg(0); set [email protected]_string$,""; set [email protected],0; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if(strtolower([email protected]$) == strtolower(@category$[[email protected]])) { setarray @itemKeys[[email protected]],[email protected]; if([email protected]_string$ == "") set [email protected]_string$,getitemname(@itemID[[email protected]]); else set [email protected]_string$,[email protected]_string$+":"+getitemname(@itemID[[email protected]]); set [email protected],[email protected]+1; } } return [email protected]_string$; } function makeCategory { set [email protected]_string$,""; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if([email protected]_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,@category$[[email protected]]; } else { if(compare([email protected]_string$,@category$[[email protected]])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,[email protected]_string$+":"[email protected]$[[email protected]]; } } } return [email protected]_string$; } function add_item { set [email protected],getarg(0,-1); //IteID set [email protected],getarg(1,-1); //Item Quantity set [email protected],getarg(2,-1); set [email protected]$,getarg(3,"Uncategorized"); //Category if([email protected] == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set [email protected],getarraysize(@itemID); setarray @itemID[[email protected]],[email protected]; setarray @itemQ[[email protected]],[email protected]; setarray @points[[email protected]],[email protected]; setarray @category$[[email protected]],[email protected]$; return 1; //return 1 as success } function garbagecol{ deletearray @itemID[0],128; deletearray @itemQ[0],128; deletearray @points[0],128; deletearray @category$[0],128; deletearray @listCat$[0],128; deletearray @itemKeys[0],128; return; } } eAthena version: //==================================================================================== //Script Name: Vote For Points NPC Script for FluxCP //SVN: Tested in rAthena r156513 //Developed By: JayPee Mateo //Version: 1.0 //Requirement(s): FluxCP V4P Addon //Description: This is a npc script for FluxCP Vote for points in order for the players //to claim their vote points //==================================================================================== prontera,151,175,5 script VoteForPoints 89,{ //Function Prototypes function garbagecol;//Garbage collection for the Character variables garbagecol(); function add_item; //Syntanx: add_item(ItemID,QUANTITY,POINTS,CATEGORY); function makeCategory;//This will return a list of the categories function getItemsByCat;//This will return the list of items associated to the particular category function getItemDetails;//This will return the details of the item function getPoints;//This will return the points of the player stored in the database function updatePoints;//This will updates the points of the player stored in the database //NPC Name set .npcname$,"[ Vote For Points ]"; //Initialization of the Rewards add_item(555,1,100,"Hello"); add_item(556,2,101,"Hello"); add_item(557,3,101,"Hello1"); add_item(607,1,10,"Ygg"); //Script Start mes .npcname$; mes "Hi! Do you want to exchange your vote points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set [email protected],select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set [email protected],select(getItemsByCat(@listCat$[[email protected]]))-1; next; mes .npcname$; set [email protected],getItemDetails(@itemKeys[[email protected]],"ItemID"); set [email protected],getItemDetails(@itemKeys[[email protected]],"quantity"); set [email protected],getItemDetails(@itemKeys[[email protected]],"points"); mes "Item ID:"[email protected]; mes "Item Name: "+getitemname([email protected]); mes "Item Quantity: "[email protected]+" pc(s)."; mes "Required Points: "[email protected]+" pt(s)."; mes "n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set [email protected],getPoints(getcharid(3)); if([email protected]>[email protected]) { next; mes .npcname$; updatePoints(getcharid(3),[email protected]); getitem [email protected],[email protected]; mes "Here you go!. Thank you for voting. Don't forget to vote again. "; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set [email protected],getPoints(getcharid(3)); mes "You currently have "[email protected]+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set [email protected]_id,getarg(0); set [email protected],getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"[email protected]+") WHERE account_id='"[email protected]_id+"'"); return; } function getPoints { set [email protected]_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="[email protected]_id+" LIMIT 1",[email protected]); if(getarraysize([email protected])==0) return 0; return [email protected][0]; } function getItemDetails { set [email protected],getarg(0); //Key set [email protected]$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if([email protected]$ == "ItemID") return @ItemID[[email protected]]; else if(([email protected]$ == "Quantity") || ([email protected]$ == "quantity")) return @itemQ[[email protected]]; else if(([email protected]$ == "Points") || ([email protected]$ == "points")) return @points[[email protected]]; else if(([email protected]$ == "Category") || ([email protected]$ == "category")) return @category$[[email protected]]; } function getItemsByCat { set [email protected]$,getarg(0); set [email protected]_string$,""; set [email protected],0; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if([email protected]$ == @category$[[email protected]]); { setarray @itemKeys[[email protected]],[email protected]; if([email protected]_string$ == "") set [email protected]_string$,getitemname(@ItemID[[email protected]]); else set [email protected]_string$,[email protected]_string$+":"+getitemname(@ItemID[[email protected]]); set [email protected],[email protected]+1; } } return [email protected]_string$; } function makeCategory { set [email protected]_string$,""; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if([email protected]_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,@category$[[email protected]]; } else { if(compare([email protected]_string$,@category$[[email protected]])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,[email protected]_string$+":"[email protected]$[[email protected]]; } } } return [email protected]_string$; } function add_item { set [email protected],getarg(0,-1); //IteID set [email protected],getarg(1,-1); //Item Quantity set [email protected],getarg(2,-1); set [email protected]$,getarg(3,"Uncategorized"); //Category if([email protected] == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set [email protected],getarraysize(@ItemID); setarray @ItemID[[email protected]],[email protected]; setarray @itemQ[[email protected]],[email protected]; setarray @points[[email protected]],[email protected]; setarray @category$[[email protected]],[email protected]$; return 1; //return 1 as success } function garbagecol{ deletearray @ItemID[0],128; deletearray @itemQ[0],128; deletearray @points[0],128; deletearray @category$[0],128; deletearray @listCat$[0],128; deletearray @itemKeys[0],128; return; } [color=#000000]}[/color] 2 Quote Link to comment Share on other sites More sharing options...
Lordamax Posted March 24, 2012 Share Posted March 24, 2012 (edited) i hope the eathena version will be fixed Edited March 24, 2012 by Lordamax Quote Link to comment Share on other sites More sharing options...
JayPee Posted March 24, 2012 Author Share Posted March 24, 2012 I already fixed it. Quote Link to comment Share on other sites More sharing options...
MaximumBlaze Posted March 25, 2012 Share Posted March 25, 2012 jaypee i got buildin_getitem Nonexistant item 0 requested whenever i try to exchange the item from the npc it will show that message on mapserver and i got no item. i have added the item id 12210 for bubble gum but when i click the npc they npc say itemID 0 quantity 1 required point 3 which is the point i put and after i press yes it give me no item and it reduce my point~ Quote Link to comment Share on other sites More sharing options...
JayPee Posted March 25, 2012 Author Share Posted March 25, 2012 can you post your modification? Quote Link to comment Share on other sites More sharing options...
Lordamax Posted March 25, 2012 Share Posted March 25, 2012 (edited) I'm having problem w/ the npc script using eAthena SVN... Sir example i've input this add_item(5013,1,15,"Lord Kaho's Horn"); Edited March 25, 2012 by Lordamax Quote Link to comment Share on other sites More sharing options...
JayPee Posted March 25, 2012 Author Share Posted March 25, 2012 Are you sure that item exist? Quote Link to comment Share on other sites More sharing options...
Lordamax Posted March 25, 2012 Share Posted March 25, 2012 Yeah! It's Lord Kaho's Horn! Quote Link to comment Share on other sites More sharing options...
JayPee Posted March 25, 2012 Author Share Posted March 25, 2012 Works fine on my test server(rAthena): Quote Link to comment Share on other sites More sharing options...
Lordamax Posted March 25, 2012 Share Posted March 25, 2012 (edited) I'm using the eAthena version of the npc to an eAthena SVN. hope it would be solved again. thanks! Edited March 25, 2012 by Lordamax Quote Link to comment Share on other sites More sharing options...
MaximumBlaze Posted March 25, 2012 Share Posted March 25, 2012 (edited) jaypee i am having same issues as lordamax please help TT_TT i am using eathena too and using the script from 1.2 and the problem is still exactly the same as lordamax Edited March 25, 2012 by MaximumBlaze Quote Link to comment Share on other sites More sharing options...
ngek202 Posted March 26, 2012 Share Posted March 26, 2012 can you try this: http://pastebin.com/raw.php?i=9XJS9eX2 Quote Link to comment Share on other sites More sharing options...
MaximumBlaze Posted March 26, 2012 Share Posted March 26, 2012 the problem is still the same ngek... problems solved Quote Link to comment Share on other sites More sharing options...
Lordamax Posted March 26, 2012 Share Posted March 26, 2012 (edited) it's still Yehey!!!!!!!!!! Problem is solved Edited March 26, 2012 by Lordamax Quote Link to comment Share on other sites More sharing options...
Elijah23 Posted April 10, 2012 Share Posted April 10, 2012 Hi!.. Is there a way to make this like a shop like npc?.. Thanks.. Quote Link to comment Share on other sites More sharing options...
Drakkus Posted April 10, 2012 Share Posted April 10, 2012 +1 for this. Quote Link to comment Share on other sites More sharing options...
noobsai Posted April 19, 2012 Share Posted April 19, 2012 i am using eathena and used the eathena npc. but the category style won't effect,, example.. category1 and category2 i added 2 items on category 1 and 3items on category 2. when i select category 2 it's supposed to show only 3 items but the problem is the items on category 1 is also there .. T_T Quote Link to comment Share on other sites More sharing options...
Snap Posted April 28, 2012 Share Posted April 28, 2012 Sir i cannot add a Voting SIte. Quote Link to comment Share on other sites More sharing options...
lakasmonk Posted May 16, 2012 Share Posted May 16, 2012 sir jaypee is this the same script thats on the release of Flux CP vote for points Quote Link to comment Share on other sites More sharing options...
Famous Posted August 2, 2012 Share Posted August 2, 2012 (edited) why its not.. working on me?? Im using Rathena svn then I have 2 vote points on my site when I add the Npc its says 0 vote points and also line 205 is error [Error]: Missing 1 right curlys at file 'npc/custom/Zhen/v4pshop.txt', line '205'. } Edited August 6, 2012 by zhen Quote Link to comment Share on other sites More sharing options...
Aeia Posted October 21, 2012 Share Posted October 21, 2012 Thank you sir Jaypee Mateo. But, I will ask something. In your script, the user will be asked for certain categories. 1 Voting Proof Ticket 10 Voting Proof Ticket How can I change it by USING INPUT BOX instead of selections? It's like. [ NPC ] How many Vote Points do you want to exchange? Please write it in the input box. So, I'll use input @var$; How? Thank you so much for replies. Also, because I have two NPCs - the one that will convert POINTS FROM SITE and then POINTS IN-GAME, and VPS Ticket is different, so that's 3 Transactions, how to put it in just ONE NPC? :| Sounds harsh... Sorry for disturbing. Quote Link to comment Share on other sites More sharing options...
imanbg Posted November 1, 2012 Share Posted November 1, 2012 Hello.. I'm suing rAthena.. Is there any guide to install this voteforpoint at FluxCP and SQL data?? Quote Link to comment Share on other sites More sharing options...
Aeia Posted November 4, 2012 Share Posted November 4, 2012 Please review our requests Help! Quote Link to comment Share on other sites More sharing options...
imanbg Posted November 20, 2012 Share Posted November 20, 2012 Anyone can answer my question?? /sob Quote Link to comment Share on other sites More sharing options...
Kringle Posted April 20, 2013 Share Posted April 20, 2013 //==================================================================================== //Script Name: Vote For Points NPC Script for FluxCP //SVN: Tested in rAthena r156513 //Developed By: JayPee Mateo //Version: 1.0 //Requirement(s): FluxCP V4P Addon //Description: This is a npc script for FluxCP Vote for points in order for the players //to claim their vote points //==================================================================================== prontera,165,167,5 script VoteForPoints 89,{ //Function Prototypes function garbagecol;//Garbage collection for the Character variables garbagecol(); function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY); function makeCategory;//This will return a list of the categories function getItemsByCat;//This will return the list of items associated to the particular category function getItemDetails;//This will return the details of the item function getPoints;//This will return the points of the player stored in the database function updatePoints;//This will updates the points of the player stored in the database //NPC Name set .npcname$,"[ Vote For Points ]"; //Initialization of the Rewards add_item(14536,2,"Consumables"); add_item(12375,2,"Consumables"); add_item(14542,2,"Consumables"); add_item(14544,2,"Consumables"); add_item(12161,6,"Consumables"); add_item(12210,10,"Consumables"); add_item(14525,5,"Consumables"); add_item(12349,3,"Consumables"); add_item(14530,3,"Consumables"); add_item(12172,3,"Consumables"); add_item(14533,5,"Consumables"); add_item(12232,5,"Consumables"); add_item(12247,3,"Consumables"); add_item(12123,2,"Consumables"); add_item(14592,1,"Consumables"); add_item(12261,20,"Consumables"); add_item(12209,1,"Consumables"); add_item(12320,1,"Consumables"); add_item(12122,1,"Consumables"); add_item(12182,3,"Consumables"); add_item(16677,1,"Consumables"); add_item(13989,1,"Box"); add_item(14287,4,"Box"); add_item(13570,3,"Box"); add_item(14288,4,"Box"); add_item(13580,10,"Box"); add_item(13973,3,"Box"); add_item(13863,2,"Box"); add_item(13940,5,"Box"); add_item(12944,24,"Rental Items"); add_item(12938,92,"Rental Items"); add_item(13959,32,"Rental Items"); add_item(12950,32,"Rental Items"); add_item(14227,30,"Rental Items"); add_item(12935,60,"Rental Items"); add_item(13513,22,"Rental Items"); add_item(12936,20,"Rental Items"); add_item(12941,22,"Rental Items"); add_item(13508,30,"Rental Items"); add_item(12937,28,"Rental Items"); //Script Start mes .npcname$; mes "Hi! Do you want to exchange your vote points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set [email protected],select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set [email protected],select(getItemsByCat(@listCat$[[email protected]]))-1; next; mes .npcname$; set [email protected],getItemDetails(@itemKeys[[email protected]],"itemid"); set [email protected],getItemDetails(@itemKeys[[email protected]],"quantity"); set [email protected],getItemDetails(@itemKeys[[email protected]],"points"); mes "Item ID:"[email protected]; mes "Item Name: "+getitemname([email protected]); mes "Item Quantity: "[email protected]+" pc(s)."; mes "Required Points: "[email protected]+" pt(s)."; mes "\n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set [email protected],getPoints(getcharid(3)); if([email protected]>[email protected]) { next; mes .npcname$; updatePoints(getcharid(3),[email protected]); getitem [email protected],[email protected]; mes "Here you go!. Thank you for voting. Don't forget to vote again. :D"; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set [email protected],getPoints(getcharid(3)); mes "You currently have "[email protected]+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set [email protected]_id,getarg(0); set [email protected],getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"[email protected]+") WHERE account_id='"[email protected]_id+"'"); return; } function getPoints { set [email protected]_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="[email protected]_id+" LIMIT 1",[email protected]); if(getarraysize([email protected])==0) return 0; return [email protected][0]; } function getItemDetails { set [email protected],getarg(0); //Key set [email protected]$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower([email protected]$) == strtolower("ItemID")) return @itemID[[email protected]]; else if(strtolower([email protected]$) == strtolower("Quantity")) return @itemQ[[email protected]]; else if(strtolower([email protected]$) == strtolower("Points")) return @points[[email protected]]; else if(strtolower([email protected]$) == strtolower("Category")) return @category$[[email protected]]; } function getItemsByCat { set [email protected]$,getarg(0); set [email protected]_string$,""; set [email protected],0; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if(strtolower([email protected]$) == strtolower(@category$[[email protected]])) { setarray @itemKeys[[email protected]],[email protected]; if([email protected]_string$ == "") set [email protected]_string$,getitemname(@itemID[[email protected]]); else set [email protected]_string$,[email protected]_string$+":"+getitemname(@itemID[[email protected]]); set [email protected],[email protected]+1; } } return [email protected]_string$; } function makeCategory { set [email protected]_string$,""; for(set [email protected],0; [email protected]<getarraysize(@category$); set [email protected],[email protected]+1) { if([email protected]_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,@category$[[email protected]]; } else { if(compare([email protected]_string$,@category$[[email protected]])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[[email protected]]; set [email protected]_string$,[email protected]_string$+":"[email protected]$[[email protected]]; } } } return [email protected]_string$; } function add_item { set [email protected],getarg(0,-1); //IteID set [email protected],getarg(1,-1); //Item Quantity set [email protected],getarg(2,-1); set [email protected]$,getarg(3,"Uncategorized"); //Category if([email protected] == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if([email protected] == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set [email protected],getarraysize(@itemID); setarray @itemID[[email protected]],[email protected]; setarray @itemQ[[email protected]],[email protected]; setarray @points[[email protected]],[email protected]; setarray @category$[[email protected]],[email protected]$; return 1; //return 1 as success } function garbagecol{ deletearray @itemID[0],128; deletearray @itemQ[0],128; deletearray @points[0],128; deletearray @category$[0],128; deletearray @listCat$[0],128; deletearray @itemKeys[0],128; return; } } I have this problem, whenever i use this at my server. r17235. even without votepoints they can spam those items. And this doesn't show the Category. I need help. Quote Link to comment Share on other sites More sharing options...