• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] refresh query every 1 sec
#1
I want to refresh pCoin after people refill wallet

but I don't know how to do it better

just want real time Coin after refill



Code:
ptask RefreshCoinTimer[1000](playerid) {

? ? if (!LoginStatus[playerid]) {

? ? ? ? return 0;

? ? }

? ? new

? ? ? ? query[100]

? ? ;

? ? mysql_format(dbCon, query, sizeof(query),

? ? "\

? ? ? ? SELECT \

? ? ? ? ? ? pCoin \

? ? ? ? FROM \

? ? ? ? ? ? players \

? ? ? ? WHERE \

? ? ? ? ? ? ID= %d\

? ? ",

? ? ? ? PlayerInfo[playerid][pID]

? ? );

? ? mysql_tquery(dbCon, query, "RefreshCoin", "i", playerid);

? ? return 1;

}



forward RefreshCoin(playerid);

public RefreshCoin(playerid) {

? ? cache_get_value_name_int(0, "pCoin", coin);



? ? PlayerInfo[playerid][pCoin] = coin;

}
  Reply
#2
Best solution if you dont show player coin in GUI. When player buy coin update coin in database side. If player want use coin in game then get current value from database and if he have enought coin then also update it in database side.
  Reply
#3
Refresh query every 1 second is terrible.

Add a command like /coin and ask the user to type this command if he/she refills the wallet and then refresh the pCoin.

The AbyssMorgan's solution is also good.
  Reply
#4
How do you refill the wallet? Is it only ingame, or can you do that externally (e.g. from a website)?
  Reply
#5
(2021-05-01, 05:17 PM)Y_Less Wrote: How do you refill the wallet?? Is it only ingame, or can you do that externally (e.g. from a website)?



Yes, from a website

refill > update coin and just do some crazy stuff to load them real time



this is how my refill site look like
  Reply


Forum Jump: