Jump to content

[REZOLVAT] MySQL Money


Yeed
 Share

Recommended Posts

Buna seara, am si eu o intrebare, am facut un sistem de buygun, dar cand cumpara player-ul o arma, nu scad banii din baza de date. Cum pot rezolva? Adica daca dau un reconnect am aceiasi bani, chiar daca mai devreme mi-a luat.

Link to comment
Share on other sites

  • Administrator

Cand cumpara o arma, ii scazi din variabila care preia banii din baza de date cand se logheaza

PlayerInfo[ playerid ][ pCash ] -= suma_armei;

Si dupa updatezi in baza de date:

new gQuery[ 128 ]; gQuery[ 0 ] = ( EOS );

mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `tabelUsers` SET `coloanaBani` = '%d' WHERE `coloanaSQLID`= '%d'", PlayerInfo[ playerid ][ pCash ], PlayerInfo[ playerid ][ pSQLID ]);
mysql_tquery( SQL, gQuery, "", "" ); 
Link to comment
Share on other sites

 

Cand cumpara o arma, ii scazi din variabila care preia banii din baza de date cand se logheaza

PlayerInfo[ playerid ][ pCash ] -= suma_armei;

Si dupa updatezi in baza de date:

new gQuery[ 128 ]; gQuery[ 0 ] = ( EOS );

mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `tabelUsers` SET `coloanaBani` = '%d' WHERE `coloanaSQLID`= '%d'", PlayerInfo[ playerid ][ pCash ], PlayerInfo[ playerid ][ pSQLID ]);
mysql_tquery( SQL, gQuery, "", "" ); 

eu as fi facut mult mai simplu, la partea cu salvarea in baza de date as fi pus : Update(playerid, pCashx); pCashx e variabila gamemodeului meu, nu stiu daca asa e si la tine.

Link to comment
Share on other sites

 

Cand cumpara o arma, ii scazi din variabila care preia banii din baza de date cand se logheaza

PlayerInfo[ playerid ][ pCash ] -= suma_armei;

Si dupa updatezi in baza de date:

new gQuery[ 128 ]; gQuery[ 0 ] = ( EOS );

mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `tabelUsers` SET `coloanaBani` = '%d' WHERE `coloanaSQLID`= '%d'", PlayerInfo[ playerid ][ pCash ], PlayerInfo[ playerid ][ pSQLID ]);
mysql_tquery( SQL, gQuery, "", "" ); 

Multumesc mult, am incercat si am facut cu Update(playerid, pMoneyx) si merge foarte bine, mersi mult!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...