SQlite stats save
#1

No work S:, Do not save anything S:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        Query[ 200 ], // We need to create such a query so we can format it.
        year,month,day
    ;
    getdate(year,month,day);

    if(pInfo[playerid][USER_LOGGED_IN] == true)
    {
    format(Query, sizeof(Query), "UPDATE `users` SET Money = '%d', Score = '%d', EXP = '%d', Kills = '%d', Deaths = '%d', Wanted = '%d', JailTime = '%d', Job = '%d', Fstyle = '%d', PlaceHit = '%d', C4 = '%d', tie = '%d', BC = '%d', BP = '%d', Cutie = '%d', Dia = '%02d', Mes = '%02d', Ano = '%d', IP = '%s' WHERE `Username` = '%s' COLLATE NOCASE",
                                                                                                        GetPlayerMonez(playerid),
                                                                                                        GetPlayerScore(playerid),
                                                                                                        pInfo[playerid][EXP],
                                                                                                        pInfo[playerid][Kills],
                                                                                                        pInfo[playerid][Deaths],
                                                                                                        pInfo[playerid][Wanted],
                                                                                                        pInfo[playerid][JailTime],
                                                                                                        pInfo[playerid][Job],
                                                                                                        pInfo[playerid][FStyle],
                                                                                                        pInfo[playerid][Placehit],
                                                                                                        pInfo[playerid][C4],
                                                                                                        pInfo[playerid][Tie],
                                                                                                        pInfo[playerid][BreakC],
                                                                                                        pInfo[playerid][BreakP],
                                                                                                        pInfo[playerid][Cutie],
                                                                                                        day,
                                                                                                        month,
                                                                                                        year,
                                                                                                        pInfo[playerid][Uip],
                                                                                                        DB_Escape(GetPlayerName(playerid))); // Gather the name of the player then escape it.
    // querying the formatted Query
    db_query(Database, Query);
    // We're going to reset this variable to false.
    pInfo[playerid][USER_LOGGED_IN] = false;
    }
    return 1;
}
Reply
#2

Change db_query(Database, Query); to :
pawn Код:
if(db_query(Database, Query))
{
      print("Yes");
}
else
{
      print("No");
}
And then reply if whether it printed yes or no...
Reply
#3

printed no D:
Reply
#4

Get SQLite Improved and enable error checking.

https://sampforum.blast.hk/showthread.php?tid=303682

Put this at top of your script

pawn Код:
#define DB_QUERY_ERRORS  true
#include <sqlitei>
You will also need the amx assembly library
https://github.com/Zeex/amx_assembly

The problem right now however is your query size is 200 when the string length is much greater than that.
Reply
#5

Quote:
Originally Posted by DkrX
Посмотреть сообщение
printed no D:
Then its your connection with the DB or the SQL is wrong...

Make sure everything is right..

or just do what Pottus said.
Reply
#6

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Get SQLite Improved and enable error checking.

https://sampforum.blast.hk/showthread.php?tid=303682

Put this at top of your script

pawn Код:
#define DB_QUERY_ERRORS  true
#include <sqlitei>
You will also need the amx assembly library
https://github.com/Zeex/amx_assembly

The problem right now however is your query size is 200 when the string length is much greater than that.
top? fatal error 111: user error: amx_assembly is required for DB_QUERY_ERRORS. Get it here: github.com/zeex/amx_assembly
Reply
#7

Yes you need the library then you will be good to go any query errors will show up for you in Windows the real nice thing about is it will tell you exactly where the problem.

What you do is download this link https://github.com/Zeex/amx_assembly/archive/master.zip extract that to your include folder make sure you extract the folder amx_assembly-master as well all the files should be in there.

Now simply rename amx_assembly-master to amx_assembly and you should have error checking enabled.
Reply
#8

Quote:
Originally Posted by DkrX
Посмотреть сообщение
top? fatal error 111: user error: amx_assembly is required for DB_QUERY_ERRORS. Get it here: github.com/zeex/amx_assembly
Cant you read ?
Just do what is written...

Download amx_assembly from github.com/zeex/amx_assembly
Reply
#9

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Yes you need the library then you will be good to go any query errors will show up for you in Windows the real nice thing about is it will tell you exactly where the problem.
Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
Cant you read ?
Just do what is written...

Download amx_assembly from github.com/zeex/amx_assembly
sorry sorry, ready!

SQLitei Error: (db_query) near " ": syntax error
Reply
#10

Quote:
Originally Posted by DkrX
Посмотреть сообщение
sorry sorry, ready!

SQLitei Error: (db_query) near " ": syntax error
Just make the size of the array bigger and then try again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)