SA-MP Forums Archive
SQLite Problems - 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: SQLite Problems (/showthread.php?tid=370971)



SQLite Problems - preda98 - 21.08.2012

Hello everyone, I reached a scripting level that involves SQLITE, more specific, an admin system with register/login included. Yesterday morning I started working at this script.
My problem is that Database is saving only the admin level, and not kills, deaths and all my player variables.As you can see, I am using rBits include, a very usefull one for arrays.
So, I hope anyone can help me.
Here is the script:
http://pastebin.com/7e5Fqhaw
Thank you, and I am waiting for answer.



Re: SQLite Problems - preda98 - 22.08.2012

UP PLEASE !


Re: SQLite Problems - [DOG]irinel1996 - 22.08.2012

Where does it save the data?
In OnPlayerDisconnect, right?


Re: SQLite Problems - preda98 - 22.08.2012

Yes, it does.
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        Query[ 200 ], 
        name[ MAX_PLAYER_NAME ] 
    ;
    GetPlayerName(playerid, name, sizeof(name)); 

    if(Bit1_Get(g_PlayerLogged, playerid) == 1)
    {
        
        format(Query,sizeof(Query),"UPDATE `USERS` SET SCORE = '%d', CASH = '%d', ADMINLEVEL = '%d', KILLS = '%d', DEATHS = '%d', RESPECT = '%d', SKIN = '%d' WHERE `NAME` = '%s' COLLATE NOCASE",
                                                                                        GetPlayerScore(playerid), 
                                                                                        GetPlayerMoney(playerid), 
                                                                                        Bit16_Get(g_AdminLevel, playerid),
                                                                                        Bit16_Get(g_Kills, playerid),
                                                                                        Bit16_Get(g_Deaths, playerid),
                                                                                        Bit16_Get(g_Respect, playerid),
                                                                                        GetPlayerSkin(playerid),
                                                                                        DB_Escape(name)); 
        db_query(Database, Query);
        Bit1_Set(g_PlayerLogged, playerid, false);
    }
    return 1;
}



Re: SQLite Problems - Vince - 22.08.2012

Quote:
Originally Posted by preda98
Посмотреть сообщение
As you can see, I am using rBits include, a very usefull one for arrays.
Everyone entitled to their own opinion, of course. But do you really expect money to never go over 65535?


Re: SQLite Problems - preda98 - 22.08.2012

Not really...


Re: SQLite Problems - [DOG]irinel1996 - 22.08.2012

Give a try to this:
http://pastebin.com/mxGx2G7v

To be honest, I didn't find any mistake there, but I made some changes.


Re: SQLite Problems - preda98 - 22.08.2012

Thank you, I will give it a try and then come back with EDIT.
EDIT: I tested, but now won't save anything, like account name or password..
I guess I will try fallowing other tutorials.
ON: Thanks for help anyway.


Re: SQLite Problems - [DOG]irinel1996 - 22.08.2012

Aaa.. By the way. Delete your old database file.
Forgot to say that.


Re: SQLite Problems - preda98 - 22.08.2012

Did that, no succes..
So far fallowed this:
https://sampforum.blast.hk/showthread.php?tid=278188