MySQL & y_inline & y_dialog
#1

I have this function, when I try to register it doesn't insert.... in to the database.

PHP код:
stock Construct_PlayerConnected(playerid) {
    
inline OnCheckPlayerAccount() {
        new 
rowsfieldscontent[129];
        
cache_get_data(rowsfieldsSQLConnection);
        if(
rows) {
            new 
loadedPassword[129];
            
cache_get_field_content(0"ID"contentSQLConnection);
            
PlayerInfo[playerid][SQLID] = strval(content);
            
cache_get_field_content(0"Password"loadedPasswordSQLConnection);
            
inline LoginResponse(pidresponselistitemstring:inputtext[]) {
                
#pragma unused pid, listitem
                
switch(response) {
                    case 
0: {
                        
// SetTimerEx("ToKick", 500, false, "dsd", playerid, "Quit on Login!", ADMIN_ANNOUCE);
                    
}
                    default: {
                        new 
passWordLogged[129];
                        
WP_Hash(passWordLogged129inputtext);
                        if(!
strcmp(passWordLoggedloadedPassword)) {
                            
inline LoadPlayerAccount() {
                                new 
iGet[256];
                                
cache_get_field_content(0"Money"iGetSQLConnection); PlayerInfo[playerid][Money] = strval(iGet); ResetPlayerMoney(playerid), GivePlayerMoney(playeridstrval(iGet));
                                
cache_get_field_content(0"Bank"iGetSQLConnection); PlayerInfo[playerid][Bank] = strval(iGet);
                                
cache_get_field_content(0"Score"iGetSQLConnection); PlayerInfo[playerid][Score] = strval(iGet); SetPlayerScore(playeridstrval(iGet));
                                
cache_get_field_content(0"Points"iGetSQLConnection); PlayerInfo[playerid][Points] = strval(iGet);
                                
cache_get_field_content(0"TotalPlayTime"iGetSQLConnection); PlayerInfo[playerid][TotalPlayTime] = strval(iGet);
                                
SetSpawnInfoplayerid001958.331343.1215.36269.152636281500);
                                
SpawnPlayer(playerid);
                                return 
1;
                            }
                            new 
iQuery[128];
                            
mysql_format(SQLConnectioniQuerysizeof(iQuery), "SELECT * FROM `PlayerInfo` WHERE `ID` = %d LIMIT 1"PlayerInfo[playerid][SQLID]);
                            
mysql_tquery_inline(SQLConnectioniQueryusing inline LoadPlayerAccount"");
                        } else {
                            
PlayerTemp[playerid][loginAttempts]++;
                            if(
PlayerTemp[playerid][loginAttempts] >= 3) {
                                
// SetTimerEx("ToKick", 500, false, "dsd", playerid, "Login limit exceeded!", ADMIN_ANNOUCE);
                                
return 1;
                            } else {
                                return 
Construct_PlayerConnected(playerid), 0;
                            }
                        }
                    }
                }
            }
            
Dialog_ShowCallback(playeridusing inline LoginResponseDIALOG_STYLE_PASSWORD"{3196ef} - "SERVER_GM"{adc7e7}""  {FFFFFF}Please enter your password to Login""Login"" ");
        } else {
            
inline RegisterResponse(pidresponselistitemstring:inputtext[]) {
                
#pragma unused pid, listitem
                
switch(response) {
                    case 
0: {
                        
// SetTimerEx("ToKick", 500, false, "dsd", playerid, "Quit on Register!", ADMIN_ANNOUCE);
                    
}
                    default: {
                        if(
strlen(inputtext) > 40 || strlen(inputtext) < || !strlen(inputtext)) {
                            
//SendClientWarning(playerid, "Invalid Password, please try again!");
                            
return Construct_PlayerConnected(playerid), 1;
                        } else {
                            new 
iQuery[256], passwordHashed[129];
                            
WP_Hash(passwordHashed129inputtext);
                            
mysql_format(SQLConnectioniQuerysizeof(iQuery), "INSERT INTO `PlayerInfo` (`PlayerName`, `Password`) VALUES ('%e', '%s')"ReturnPlayerName(playerid), passwordHashed);
                            
mysql_tquery(SQLConnectioniQuery);
                            
Construct_PlayerConnected(playerid);
                            return 
1;
                        }
                    }
                }
            }
            
Dialog_ShowCallback(playeridusing inline RegisterResponseDIALOG_STYLE_PASSWORD"{3196ef} - "SERVER_GM"{adc7e7}""  {FFFFFF}Please enter your password to Register""Register""");
        }
    }
    new 
iQuery[128];
    
mysql_format(SQLConnectioniQuerysizeof(iQuery), "SELECT `ID`, `Password` FROM `PlayerInfo` WHERE `PlayerName` = '%e' LIMIT 1"ReturnPlayerName(playerid));
    
mysql_tquery_inline(SQLConnectioniQueryusing inline OnCheckPlayerAccount"");
    return 
1;

Reply
#2

Do you see any errors in mysql_log?
Reply
#3

Sorry, I've fixed it forgot to add dialogid in the response line! Stupid mistake.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)