Jump to content
  • 0
Sign in to follow this  
AdmCronus

Script with Sql database

Question

6 answers to this question

Recommended Posts

  • 0

maybe edit jaypee's v4p
https://github.com/mandark022/VoteForPoints/blob/master/npc%20script/rAthena/voteforpoints.txt
 

function updatePoints {set .@char_id,getarg(0);set .@usedPoints,getarg(1);query_sql("UPDATE `chars` SET puntos=(puntos-"+.@usedPoints+") WHERE char_id='"+.@char_id+"'");return;}function getPoints {set .@char_id,getarg(0);query_sql("SELECT `puntos` FROM `char` WHERE charid_id="+.@char_id+" LIMIT 1",.@points);if(getarraysize(.@points)==0)return 0;return .@points[0];}

change also

updatePoints(getcharid(0),.@rpoints);

getPoints(getcharid(0);


Did not test mwahah

Share this post


Link to post
Share on other sites
  • 0

is good, but i need to sell :

exemple when player talk with npc for buy item per puntos.

getitem 608,50;
query_sql("UPDATE `chars` SET puntos=(puntos-100) WHERE char_id='"+.@char_id+"'");
 
 
how i do?
Edited by AdmCronus

Share this post


Link to post
Share on other sites
  • 0
You're gonna make 608 to be points?
 
set .@count, countitem(608);
if (.@count == 0) end;
delitem 608, .@count;
query_sql("UPDATE `chars` SET puntos=(puntos+" +.@count+ ") WHERE char_id="+.@char_id);

Share this post


Link to post
Share on other sites
  • 0

are invert, i need to make items for puntos.

ex:

607 x 20 for 10 pontos

678 x 50 for 15 pontos

 

need to count if player have punto  for get item. understand?

Edited by AdmCronus

Share this post


Link to post
Share on other sites
  • 0

the first post does it. its a configurable seller npc.

 

set .@charid, getcharid(0);query_sql("SELECT `puntos` FROM `char` WHERE `charid_id`=" +.@char_id, .@points);query_sql("UPDATE `char` SET puntos=(puntos-" +@points+ ") WHERE char_id="+.@char_id);getitem 502, @points; 

 


 

Share this post


Link to post
Share on other sites
  • 0

i will test, and for check if player have puntos or not for he buy.

 

npc check player have 5 pontos for buy item 607.

Edited by AdmCronus

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.