Jump to content
  • 0

Prize giver (vote points)


x13th

Question


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  11/20/11
  • Last Seen:  

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)+"'");

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  11/20/11
  • Last Seen:  

anyone?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  189
  • Reputation:   16
  • Joined:  11/20/11
  • Last Seen:  

Or you could use account variables o-o. Ex. #votepoints

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   35
  • Joined:  12/13/11
  • Last Seen:  

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 by lilcooldude69
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   3
  • Joined:  12/10/11
  • Last Seen:  

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 by Magic-Maker
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...