SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/05/2020, 03:48 PM   #1
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 223
Reputation: 4
Default Problem in editing Cache Login/register system by BlueG

++check my last post

I had a problem, i posted on this forum but i thought i was just dumb and a thing was missing.
Actually, i'm having bigger problems.
PHP Code:
function playerUpdate(playeridtype) {
    if(
IsPlayerConnected(playerid)) {
        new var[
356];
        switch(
type) {
            case 
pCashxmysql_format(HSQL, var, sizeof(var), "UPDATE `users` SET `Cash`='%d' WHERE `ID`='%d'"PlayerInfo[playerid][pCash], PlayerInfo[playerid][pSQLID]); 
            case 
pBankxmysql_format(HSQL, var, sizeof(var), "UPDATE `users` SET `Bank`='%d' WHERE `ID`='%d'"PlayerInfo[playerid][pBank], PlayerInfo[playerid][pSQLID]);
            case 
pSecondsxmysql_format(HSQL, var, sizeof(var), "UPDATE `users` SET `Seconds`='%d' WHERE `ID`='%d'"PlayerInfo[playerid][pSeconds], PlayerInfo[playerid][pSQLID]);                     
        }
        
mysql_tquery(HSQL, var, """");
    }
    return 
1;

when the server tries to update seconds it actually says this after i've put the mysql log to ALL.
PHP Code:
[18:38:45] [DEBUGmysql_format(10x072A0A00356"UPDATE `users` SET `Seconds`='%d' WHERE `ID`='%d'") (S:\Godtier\pawno\include\meduzza/enums-updatex.pwn:214 -> S:/Godtier/gamemodes/meduzza.pwn:1584)
[
18:38:45] [DEBUGmysql_format: return value'47' (S:\Godtier\pawno\include\meduzza/enums-updatex.pwn:214 -> S:/Godtier/gamemodes/meduzza.pwn:1584)
[
18:38:45] [DEBUGmysql_tquery(1"UPDATE `users` SET `Seconds`='0' WHERE `ID`='8'""""") (S:\Godtier\pawno\include\meduzza/enums-updatex.pwn:220 -> S:/Godtier/gamemodes/meduzza.pwn:1584)
[
18:38:45] [DEBUGCCallback::Create(amx=0x29fa6e8name=''format=''params=0x72a09ecparam_offset=5)
[
18:38:45] [DEBUGCHandle::Execute(this=0x5df7d0type=1query=0x53a708)
[
18:38:45] [DEBUGCHandle::Execute - return valuetrue 
it is 0 everytime it worked before when i was on orm, but after i switched to cache it is not saving any data...
i don't know... what should i show? i dont even have idea...

(it worked very well before switching to this frikin cache)
__________________

Last edited by hopeonxanny; 29/05/2020 at 05:43 AM.
hopeonxanny is offline   Reply With Quote
Old 28/05/2020, 03:56 PM   #2
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 223
Reputation: 4
Default Re: Problem in editing Cache Login/register system by BlueG

i moved my callback here, like this:
PHP Code:
case DIALOG_LOGIN: {
            if (!
response) return Kick(playerid);
            new 
hashed_pass[65];            
            
SHA256_PassHash(inputtextPlayerInfo[playerid][pSalt], hashed_pass65);
            if (
strcmp(hashed_passPlayerInfo[playerid][pPassword]) == 0) {  // daca parola e CORECTA, va continua executarea codului;    
                
ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_MSGBOX"Login""You have been successfully logged in.""Okay""");
                
                
cache_set_active(PlayerInfo[playerid][Cache_ID]);

                
AssignPlayerData(playerid);
                
OnPlayerRegister(playerid); // this is the callback

                
cache_delete(PlayerInfo[playerid][Cache_ID]);
                
PlayerInfo[playerid][Cache_ID] = MYSQL_INVALID_CACHE;

                
KillTimer(PlayerInfo[playerid][LoginTimer]);
                
PlayerInfo[playerid][LoginTimer] = 0;
                
PlayerInfo[playerid][IsLoggedIn] = true;
                
OnPlayerLoginIn(playeridhashed_pass);
            }
            else { 
and it got called!!!!!!!!
but if i do it like this
PHP Code:
case DIALOG_REGISTER_FINAL: {
            if(!
response) {
                
PlayerInfo[playerid][pReferral] = 0;
                
gQuery[0] = EOS;
                
mysql_format(HSQLgQuerysizeof(gQuery), "INSERT INTO `users` (`Name`, `Password`, `SareDeMare`, `Email`, `Age`, `Sex`, `Charr`, `Referral`) VALUES ('%e', '%s', '%e', '%e', '%d', '%d', '%d', '%d')"PlayerInfo[playerid][pUsername], PlayerInfo[playerid][pPassword], PlayerInfo[playerid][pSalt], PlayerInfo[playerid][pEmail], PlayerInfo[playerid][pAge], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pChar], PlayerInfo[playerid][pReferral]);
                
mysql_tquery(HSQLgQuery);
                
OnPlayerRegister(playerid);
            }
            
//baga jucatorul in tutorial.
        

it is not getting called at all... i don't have any idea.. what does this cache do... the wiki docs didn't help me too much...
__________________
hopeonxanny is offline   Reply With Quote
Old 28/05/2020, 04:40 PM   #3
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,064
Reputation: 106
Default Re: Problem in editing Cache Login/register system by BlueG

I don't think you need a threaded query for what you are doing at all..

pawn Code:
mysql_query(HSQL, gQuery);
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 28/05/2020, 05:13 PM   #4
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 223
Reputation: 4
Default Re: Problem in editing Cache Login/register system by BlueG

yes... but what about the other?
im confused as heck..
__________________
hopeonxanny is offline   Reply With Quote
Old 29/05/2020, 05:42 AM   #5
hopeonxanny
Huge Clucker
 
hopeonxanny's Avatar
 
Join Date: Apr 2020
Location: SA-MP Awesomeness: 1998
Posts: 223
Reputation: 4
Default Re: Problem in editing Cache Login/register system by BlueG

i had to replace it with this.
PHP Code:
mysql_tquery(HSQLgQuery"OnPlayerRegister""d"playerid); 
instead
PHP Code:
mysql_tquery(HSQLgQuery); 
__________________
hopeonxanny is offline   Reply With Quote
Old 29/05/2020, 07:59 AM   #6
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: Problem in editing Cache Login/register system by BlueG

Did you retrieve the row id on the OnPlayerRegister callback like i told you to do? Why are you querying then using a function instead of threading it?

Where do you assign the value of PlayerInfo[x][Seconds]?
Runn3R is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Login/Register System Mysql r8 (version cache) raddetine Filterscripts 12 15/01/2015 06:53 AM
Login/Register system problem Opptur Scripting Help 6 04/08/2012 05:58 PM
Problem in Register & Login system Firo Scripting Help 20 02/06/2012 04:46 PM
Problem with login/register system! Dr0gIraN Scripting Help 2 01/06/2012 05:55 PM
Register/Login/System Problem Help Montis123 Help Archive 1 27/05/2010 07:30 PM


All times are GMT. The time now is 06:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.