JayPee Posted March 24, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 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 .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1; next; mes .npcname$; set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid"); set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity"); set .@rpoints,getItemDetails(@itemKeys[.@selected],"points"); mes "Item ID:"+.@ritemid; mes "Item Name: "+getitemname(.@ritemid); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@ritemid,.@rquantity; 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 .@points,getPoints(getcharid(3)); mes "You currently have "+.@points+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'"); return; } function getPoints { set .@account_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) return 0; return .@points[0]; } function getItemDetails { set .@key,getarg(0); //Key set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower(.@detail$) == strtolower("ItemID")) return @itemID[.@key]; else if(strtolower(.@detail$) == strtolower("Quantity")) return @itemQ[.@key]; else if(strtolower(.@detail$) == strtolower("Points")) return @points[.@key]; else if(strtolower(.@detail$) == strtolower("Category")) return @category$[.@key]; } function getItemsByCat { set .@selectedCat$,getarg(0); set .@make_string$,""; set .@x,0; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(strtolower(.@selectedCat$) == strtolower(@category$[.@i])) { setarray @itemKeys[.@x],.@i; if(.@make_string$ == "") set .@make_string$,getitemname(@itemID[.@i]); else set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]); set .@x,.@x+1; } } return .@make_string$; } function makeCategory { set .@make_string$,""; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@make_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,@category$[.@i]; } else { if(compare(.@make_string$,@category$[.@i])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,.@make_string$+":"+@category$[.@i]; } } } return .@make_string$; } function add_item { set .@itemID,getarg(0,-1); //IteID set .@itemQ,getarg(1,-1); //Item Quantity set .@points,getarg(2,-1); set .@cat$,getarg(3,"Uncategorized"); //Category if(.@itemID == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if(.@itemQ == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if(.@points == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set .@key,getarraysize(@itemID); setarray @itemID[.@key],.@itemID; setarray @itemQ[.@key],.@itemQ; setarray @points[.@key],.@points; setarray @category$[.@key],.@cat$; 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 .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1; next; mes .npcname$; set .@rItemID,getItemDetails(@itemKeys[.@selected],"ItemID"); set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity"); set .@rpoints,getItemDetails(@itemKeys[.@selected],"points"); mes "Item ID:"+.@rItemID; mes "Item Name: "+getitemname(.@rItemID); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@rItemID,.@rquantity; 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 .@points,getPoints(getcharid(3)); mes "You currently have "+.@points+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'"); return; } function getPoints { set .@account_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) return 0; return .@points[0]; } function getItemDetails { set .@key,getarg(0); //Key set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(.@detail$ == "ItemID") return @ItemID[.@key]; else if((.@detail$ == "Quantity") || (.@detail$ == "quantity")) return @itemQ[.@key]; else if((.@detail$ == "Points") || (.@detail$ == "points")) return @points[.@key]; else if((.@detail$ == "Category") || (.@detail$ == "category")) return @category$[.@key]; } function getItemsByCat { set .@selectedCat$,getarg(0); set .@make_string$,""; set .@x,0; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@selectedCat$ == @category$[.@i]); { setarray @itemKeys[.@x],.@i; if(.@make_string$ == "") set .@make_string$,getitemname(@ItemID[.@i]); else set .@make_string$,.@make_string$+":"+getitemname(@ItemID[.@i]); set .@x,.@x+1; } } return .@make_string$; } function makeCategory { set .@make_string$,""; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@make_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,@category$[.@i]; } else { if(compare(.@make_string$,@category$[.@i])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,.@make_string$+":"+@category$[.@i]; } } } return .@make_string$; } function add_item { set .@ItemID,getarg(0,-1); //IteID set .@itemQ,getarg(1,-1); //Item Quantity set .@points,getarg(2,-1); set .@cat$,getarg(3,"Uncategorized"); //Category if(.@ItemID == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if(.@itemQ == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if(.@points == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set .@key,getarraysize(@ItemID); setarray @ItemID[.@key],.@ItemID; setarray @itemQ[.@key],.@itemQ; setarray @points[.@key],.@points; setarray @category$[.@key],.@cat$; 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 Group: Members Topic Count: 71 Topics Per Day: 0.01 Content Count: 328 Reputation: 13 Joined: 11/27/11 Last Seen: July 2, 2016 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 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 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 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 11 Reputation: 0 Joined: 03/19/12 Last Seen: April 10, 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 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 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 Group: Members Topic Count: 71 Topics Per Day: 0.01 Content Count: 328 Reputation: 13 Joined: 11/27/11 Last Seen: July 2, 2016 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 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 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 Group: Members Topic Count: 71 Topics Per Day: 0.01 Content Count: 328 Reputation: 13 Joined: 11/27/11 Last Seen: July 2, 2016 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 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 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 Group: Members Topic Count: 71 Topics Per Day: 0.01 Content Count: 328 Reputation: 13 Joined: 11/27/11 Last Seen: July 2, 2016 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 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 11 Reputation: 0 Joined: 03/19/12 Last Seen: April 10, 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 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 530 Reputation: 33 Joined: 01/17/12 Last Seen: August 16, 2017 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 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 11 Reputation: 0 Joined: 03/19/12 Last Seen: April 10, 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 Group: Members Topic Count: 71 Topics Per Day: 0.01 Content Count: 328 Reputation: 13 Joined: 11/27/11 Last Seen: July 2, 2016 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 Group: Members Topic Count: 46 Topics Per Day: 0.01 Content Count: 292 Reputation: 17 Joined: 12/12/11 Last Seen: Thursday at 02:33 PM 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 Group: Members Topic Count: 39 Topics Per Day: 0.01 Content Count: 386 Reputation: 15 Joined: 11/17/11 Last Seen: September 13, 2024 Share Posted April 10, 2012 +1 for this. Quote Link to comment Share on other sites More sharing options...
noobsai Posted April 19, 2012 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 70 Reputation: 0 Joined: 02/05/12 Last Seen: February 17 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 Group: Members Topic Count: 64 Topics Per Day: 0.01 Content Count: 186 Reputation: 0 Joined: 04/07/12 Last Seen: May 18, 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 Group: Members Topic Count: 33 Topics Per Day: 0.01 Content Count: 231 Reputation: 24 Joined: 12/18/11 Last Seen: 1 hour ago 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 Group: Members Topic Count: 145 Topics Per Day: 0.03 Content Count: 455 Reputation: 3 Joined: 06/19/12 Last Seen: February 26, 2018 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 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 63 Reputation: 1 Joined: 09/18/12 Last Seen: January 4, 2017 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 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 0 Joined: 01/04/12 Last Seen: May 12, 2014 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 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 63 Reputation: 1 Joined: 09/18/12 Last Seen: January 4, 2017 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 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 0 Joined: 01/04/12 Last Seen: May 12, 2014 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 Group: Members Topic Count: 10 Topics Per Day: 0.00 Content Count: 34 Reputation: 1 Joined: 06/14/12 Last Seen: May 3, 2020 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 .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1; next; mes .npcname$; set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid"); set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity"); set .@rpoints,getItemDetails(@itemKeys[.@selected],"points"); mes "Item ID:"+.@ritemid; mes "Item Name: "+getitemname(.@ritemid); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "\n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@ritemid,.@rquantity; 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 .@points,getPoints(getcharid(3)); mes "You currently have "+.@points+" pt(s)."; garbagecol(); close; } end; //Functions Bodies function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'"); return; } function getPoints { set .@account_id,getarg(0); query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) return 0; return .@points[0]; } function getItemDetails { set .@key,getarg(0); //Key set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower(.@detail$) == strtolower("ItemID")) return @itemID[.@key]; else if(strtolower(.@detail$) == strtolower("Quantity")) return @itemQ[.@key]; else if(strtolower(.@detail$) == strtolower("Points")) return @points[.@key]; else if(strtolower(.@detail$) == strtolower("Category")) return @category$[.@key]; } function getItemsByCat { set .@selectedCat$,getarg(0); set .@make_string$,""; set .@x,0; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(strtolower(.@selectedCat$) == strtolower(@category$[.@i])) { setarray @itemKeys[.@x],.@i; if(.@make_string$ == "") set .@make_string$,getitemname(@itemID[.@i]); else set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]); set .@x,.@x+1; } } return .@make_string$; } function makeCategory { set .@make_string$,""; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@make_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,@category$[.@i]; } else { if(compare(.@make_string$,@category$[.@i])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,.@make_string$+":"+@category$[.@i]; } } } return .@make_string$; } function add_item { set .@itemID,getarg(0,-1); //IteID set .@itemQ,getarg(1,-1); //Item Quantity set .@points,getarg(2,-1); set .@cat$,getarg(3,"Uncategorized"); //Category if(.@itemID == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if(.@itemQ == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if(.@points == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set .@key,getarraysize(@itemID); setarray @itemID[.@key],.@itemID; setarray @itemQ[.@key],.@itemQ; setarray @points[.@key],.@points; setarray @category$[.@key],.@cat$; 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...
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.