letstry Posted June 20, 2012 Group: Members Topic Count: 87 Topics Per Day: 0.02 Content Count: 219 Reputation: 0 Joined: 05/03/12 Last Seen: September 15, 2023 Share Posted June 20, 2012 How will I use this kind of points? any scripts there? Thanks BUMPPPPP Bump -.- BUUUMP Quote Link to comment Share on other sites More sharing options...
plankt Posted June 20, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 130 Reputation: 43 Joined: 12/11/11 Last Seen: July 16, 2017 Share Posted June 20, 2012 Depends on how it's stored, usually a NPC is included when you add a voting system like this. Otherwise, check if you have a table in the database containing these points. Then you can access that with "*query_sql()" Quote Link to comment Share on other sites More sharing options...
letstry Posted June 21, 2012 Group: Members Topic Count: 87 Topics Per Day: 0.02 Content Count: 219 Reputation: 0 Joined: 05/03/12 Last Seen: September 15, 2023 Author Share Posted June 21, 2012 (edited) Why I cant talk to this NPC? //==================================================================================== //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; } Edited June 21, 2012 by Arcenciel Codeboxed Quote Link to comment Share on other sites More sharing options...
plankt Posted June 21, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 130 Reputation: 43 Joined: 12/11/11 Last Seen: July 16, 2017 Share Posted June 21, 2012 Are you sure that you have tabbed the header? Replace <tab> with an actual tab: prontera,151,175,5<tab>script<tab>VoteForPoints<tab>89,{ Do you get any error messages? Quote Link to comment Share on other sites More sharing options...
letstry Posted June 22, 2012 Group: Members Topic Count: 87 Topics Per Day: 0.02 Content Count: 219 Reputation: 0 Joined: 05/03/12 Last Seen: September 15, 2023 Author Share Posted June 22, 2012 Yes I used tab on them BUMP Bump Quote Link to comment Share on other sites More sharing options...
plankt Posted June 22, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 130 Reputation: 43 Joined: 12/11/11 Last Seen: July 16, 2017 Share Posted June 22, 2012 Do you get any error messages? Quote Link to comment Share on other sites More sharing options...
letstry Posted June 22, 2012 Group: Members Topic Count: 87 Topics Per Day: 0.02 Content Count: 219 Reputation: 0 Joined: 05/03/12 Last Seen: September 15, 2023 Author Share Posted June 22, 2012 None Quote Link to comment Share on other sites More sharing options...
Rikimaru Posted June 22, 2012 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 658 Reputation: 57 Joined: 11/20/11 Last Seen: July 1, 2017 Share Posted June 22, 2012 Hmm...Your VotePoints have to be saved in another SQL table on your control pannel. So the NPC has to connect to that table and get the amount of the vote points,but if your MapServer doesn't give you any errors,then it's hard to find what's wrong with that script. Quote Link to comment Share on other sites More sharing options...
Question
letstry
How will I use this kind of points? any scripts there? Thanks
BUMPPPPP
Bump -.-
BUUUMP
Link to comment
Share on other sites
7 answers to this question
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.