Lord Ganja Posted August 7, 2012 Group: Members Topic Count: 141 Topics Per Day: 0.03 Content Count: 444 Reputation: 22 Joined: 06/18/12 Last Seen: August 11, 2018 Share Posted August 7, 2012 (edited) I got problem with the Voteforpoints script by Jaypee. I'm using the dynamic npc made by Lunar, and I changed zeny into .@points, so it should get the votepoints. but when I click the npc. It shows no votepoints. The points aren't updated. What script should I used? btw, here's my script. - shop upperhgr#v4p -1,501:50 que_temsky,87,147,5 script Upper Headgear#v4p 436,{ function getPoints; function updatePoints; dispbottom "You currently have "+.@points+" Vote Points."; set @i,0; mes "[Vote for Points]"; mes "Which item do you wish to obtain?"; mes "Select only one."; callshop "upperhgr#v4p",1; npcshopattach "upperhgr#v4p"; end; OnBuyItem: if(.BuildQuest) { for(set .e,0; !compare(getarg(.e+1),".@points"); set .e,.e+2) {} npcshopadditem "upperhgr#v4p",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"S.@points"); setarray .Shop[.i],getarg(.e+2); set .i,.i+1; goto Quest_Setup; } if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; } for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; } mes "[Vote for Points]"; mes "I require the following:"; for(set @i,0; !compare(getarg(@i+1),".@points"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]"; if(getarg(@i)) mes "^FF0000" + ((.@points>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Vote Points"; mes "^000000In exchange, I will give you:^0000FF"; for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i)); switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) { case 1: for(set @i,0; !compare(getarg(@i+1),".@points"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) { next; mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + "."; mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000."; close; } if(.@points < getarg(@i)) { next; mes "[Vote for Points]"; mes "You do not have enough Vote Points."; mes "Please obtain ^FF0000" + (getarg(@i)-.@points) + " more Vote Points^000000."; close; } for(set @i,0; !compare(getarg(@i+1),".@points"); set @i,@i+2) delitem getarg(@i),getarg(@i+1); set .@points,.@points-getarg(@i); for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1); dispbottom "You now have "+.@points+" Vote Points left."; if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all; close; case 2: set @bottomview, getlook(3); set @topview, getlook(4); set @midview, getlook(5); addtimer 1000, strnpcinfo(3)+"::On_Leave"; set @equip,getiteminfo(@bought_nameid, 5); set @view, getiteminfo(@bought_nameid, 11); if(@equip != -1 && @view > 0) { if(@equip & 1) atcommand "@changelook 3 " + @view; if(@equip & 256) atcommand "@changelook 1 " + @view; if(@equip & 512) atcommand "@changelook 2 " + @view; } next; goto OnBuyItem; case 3: close; } On_Leave: atcommand "@changelook 1 " + @topview; atcommand "@changelook 2 " + @midview; atcommand "@changelook 3 " + @bottomview; set @equip,0; set @view,0; set @topview,0; set @midview,0; set @bottomview,0; end; OnInit: npcshopitem "upperhgr#v4p",0,0; set .BuildQuest,1; set .i,1; Quest_Setup: switch(.i) { default: set .BuildQuest,0; set .e,0; set .i,0; end; case 1: callsub OnBuyItem,5,"S.@points",5474,1; case 2: callsub OnBuyItem,5,"S.@points",21453,1; case 3: callsub OnBuyItem,5,"S.@points",21454,1; case 4: callsub OnBuyItem,5,"S.@points",21609,1; case 5: callsub OnBuyItem,5,"S.@points",21389,1; case 6: callsub OnBuyItem,5,"S.@points",21420,1; case 7: callsub OnBuyItem,5,"S.@points",21424,1; case 8: callsub OnBuyItem,5,"S.@points",21427,1; case 9: callsub OnBuyItem,5,"S.@points",21428,1; case 10: callsub OnBuyItem,5,"S.@points",21429,1; } 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]; } } Edited August 8, 2012 by Joseph Codebox. Quote Link to comment Share on other sites More sharing options...
Euphy Posted August 9, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted August 9, 2012 callsub OnBuyItem,5,"S.@points",5474,1; It should be clear that "S.@points" is an incorrect argument (whatever it is). Lunar's quest shop doesn't support variables, so use mine instead. Quote Link to comment Share on other sites More sharing options...
Lord Ganja Posted August 9, 2012 Group: Members Topic Count: 141 Topics Per Day: 0.03 Content Count: 444 Reputation: 22 Joined: 06/18/12 Last Seen: August 11, 2018 Author Share Posted August 9, 2012 Thanks for you reply Euphy. I'll try your script.. I'll just post here if incase I encounter a problem. Thanks! Quote Link to comment Share on other sites More sharing options...
Question
Lord Ganja
I got problem with the Voteforpoints script by Jaypee.
I'm using the dynamic npc made by Lunar, and I changed zeny into .@points, so it should get the votepoints.
but when I click the npc. It shows no votepoints. The points aren't updated.
What script should I used?
btw, here's my script.
Edited by JosephCodebox.
Link to comment
Share on other sites
2 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.