Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] refresh query every 1 sec

 
  • 0 Vote(s) - 0 Average
Pawn refresh query every 1 sec
Zow
Offline

Burgershot Member
Posts: 34
Threads: 20
Joined: Apr 2019
Reputation: 0
Location: Malaysia
#1
2021-05-01, 11:40 AM
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;
}
AbyssMorgan
Offline

Burgershot Member
Posts: 63
Threads: 25
Joined: Apr 2021
Reputation: 8
Location: Poland
#2
2021-05-01, 11:49 AM
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.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#3
2021-05-01, 01:31 PM
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.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#4
2021-05-01, 05:17 PM
How do you refill the wallet? Is it only ingame, or can you do that externally (e.g. from a website)?
Zow
Offline

Burgershot Member
Posts: 34
Threads: 20
Joined: Apr 2019
Reputation: 0
Location: Malaysia
#5
2021-05-01, 08:59 PM
(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
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode