SA-MP Forums Archive
MYSQL CODE TO SAVE STATS? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL CODE TO SAVE STATS? (/showthread.php?tid=593719)



MYSQL CODE TO SAVE STATS? - xDanielx - 08.11.2015

What is CODE to save player stats?


Re: MYSQL CODE TO SAVE STATS? - jeffery30162 - 08.11.2015

I made a tutorial about this, click here:

[SYE] Mysql Register/Load/Save Player System

Glad to help =)


Re: MYSQL CODE TO SAVE STATS? - xDanielx - 08.11.2015

Quote:
Originally Posted by jeffery30162
Посмотреть сообщение
I made a tutorial about this, click here:

[SYE] Mysql Register/Load/Save Player System

Glad to help =)
Thanks...In this case loading works for me,but saving not..Should i just place saving code ?


Re: MYSQL CODE TO SAVE STATS? - iGetty - 09.11.2015

Depending on the SQL you use, it all depends on the code you should be using.

The query should be:

pawn Код:
mysql_format(DB_CON, query, sizeof(query), "UPDATE `players` SET `Age`=%d WHERE `ID`=%d", PlayerInfo[playerid][pAge], PlayerInfo[playerid][pAccountID]);
mysql_tquery(DB_CON, query);



Re: MYSQL CODE TO SAVE STATS? - xDanielx - 09.11.2015

Quote:
Originally Posted by iGetty
Посмотреть сообщение
Depending on the SQL you use, it all depends on the code you should be using.

The query should be:

pawn Код:
mysql_format(DB_CON, query, sizeof(query), "UPDATE `players` SET `Age`=%d WHERE `ID`=%d", PlayerInfo[playerid][pAge], PlayerInfo[playerid][pAccountID]);
mysql_tquery(DB_CON, query);
Where i put that code bro?Im not into samp scripting to much.Thanks


Re: MYSQL CODE TO SAVE STATS? - xDanielx - 09.11.2015

pawn Код:
// Setup local variables
    new query[200], ban_query[200], playerName[24], playersName[24], playersIP[16];
    GetPlayerName(playerid, playerName, 24);

    format(query, sizeof(query), "SELECT `playerName` FROM `playerdata` WHERE playerName = '%s' LIMIT 1", playerName);
    mysql_query(query, MYSQL_RESULT_CHECK, playerid, connection);

    GetPlayerName(playerid, playersName, sizeof(playersName));
    GetPlayerIp(playerid, playersIP, sizeof(playersIP));

I think this is my saving section....not sure :/