x13th Posted December 15, 2011 Group: Members Topic Count: 55 Topics Per Day: 0.01 Content Count: 206 Reputation: 14 Joined: 11/20/11 Last Seen: April 9, 2024 Share Posted December 15, 2011 Hi. I want the event npc to give a prize which is vote points but the problem is npc dont give me points. here's the script query_sql ("SELECT `points` FROM `v4p_voters_info` WHERE `accountid` = '"+getcharid(3)+"'", @vote); set .@new, @vote +5;// if( .@new < 0 ) // safty first.. set .@new, 0; dispbottom "Gained Reward Points. Current Reward Points:"+.@new+""; query_sql("UPDATE `v4p_voters_info` SET `points` = '"+.@new+"' WHERE `accountid` = '"+getcharid(3)+"'"); Quote Link to comment Share on other sites More sharing options...
x13th Posted December 15, 2011 Group: Members Topic Count: 55 Topics Per Day: 0.01 Content Count: 206 Reputation: 14 Joined: 11/20/11 Last Seen: April 9, 2024 Author Share Posted December 15, 2011 anyone? Quote Link to comment Share on other sites More sharing options...
iFoxkun Posted December 16, 2011 Group: Members Topic Count: 24 Topics Per Day: 0.00 Content Count: 189 Reputation: 16 Joined: 11/20/11 Last Seen: January 4, 2014 Share Posted December 16, 2011 Or you could use account variables o-o. Ex. #votepoints Quote Link to comment Share on other sites More sharing options...
LCDTheOG Posted December 16, 2011 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 223 Reputation: 36 Joined: 12/13/11 Last Seen: February 1 Share Posted December 16, 2011 (edited) Hi. I want the event npc to give a prize which is vote points but the problem is npc dont give me points. here's the script query_sql ("SELECT `points` FROM `v4p_voters_info` WHERE `accountid` = '"+getcharid(3)+"'", @vote); set .@new, @vote +5;// if( .@new < 0 ) // safty first.. set .@new, 0; dispbottom "Gained Reward Points. Current Reward Points:"+.@new+""; query_sql("UPDATE `v4p_voters_info` SET `points` = '"+.@new+"' WHERE `accountid` = '"+getcharid(3)+"'"); your if statement isnt closed that may be why, also u have alot of "" around the update and select statments use this http://www.eathena.ws/board/index.php?showtopic=279893&hl=hourly+rates as a refrence on how many quotes u should be using :X Edited December 16, 2011 by lilcooldude69 Quote Link to comment Share on other sites More sharing options...
Magic-Maker Posted December 16, 2011 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 23 Reputation: 3 Joined: 12/10/11 Last Seen: December 14, 2012 Share Posted December 16, 2011 (edited) May be that account haven't any row in table yet, Because I haven't seen any "Insert" in your code.so It can't UPDATE to the table that haven't any row yet. I suggest you to use "REPLACE" instead of "UPDATE", It let you inset a new row if it haven't and replace it if it already have it. (Make sure you set accountid to primary key). query_sql("REPLACE INTO `v4p_voters_info` SET `accountid` = '"+getcharid(3)+"',`points` = '"+.@new+"'"); PS. IF you have other filed just set it to in replace, otherwise your data will lost T T Or another way Is check that if he don't have the point,you insert it and if he already have it, you update it. But i think use replace is more easy. By the way it's your choice Edited December 16, 2011 by Magic-Maker 1 Quote Link to comment Share on other sites More sharing options...
Question
x13th
Hi. I want the event npc to give a prize which is vote points but the problem is npc dont give me points.
here's the script
Link to comment
Share on other sites
4 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.