Jump to content
  • 0
Sign in to follow this  
AdmCronus

Script with Sql database

Question

i need to sell items for pont in databse see tabela:

ALTER TABLE `char` ADD `pontos` INT NOT NULL ;

i need player buy item for this pont.

how i do?

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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