mysql dialog don't show
#1

I guys when i do this code :
PHP код:
public OnPlayerConnect(playerid)
{
    
// connexion message
    
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s has joined The Aviation Life."name);
    
SendClientMessageToAll(COULEUR_BLEUCLAIRstring);
    
SendClientMessage(playeridCOULEUR_ROUGE"[WARNING]press the spawn button.");
    new 
query[128], playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
mysql_format(mysqlquerysizeof(query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
    
mysql_tquery(mysqlquery"OnAccountCheck""i"playerid);
    return 
true;
}
forward OnAccountCheck(playerid);
public 
OnAccountCheck(playerid)
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
        
cache_get_field_content(0"Password"Player[playerid][Password], mysql129);
        
Player[playerid][ID] = cache_get_field_content_int(0"ID");
        
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Login""Welcome player!\nYour account has been found in our database. Please fill in your password:""Login""Quit");
    }
    else
    {
        
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Register""Welcome player!\nYour account has not been registered yet. Please fill in your desired password:""Register""Quit");
    }
    return 
true;

it's not show a dialog, please help me thank you for the help
Reply
#2

Have you got the OnDialogResponse code?
Reply
#3

yes here it there :
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_CLASSES)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0ShowPlayerDialog(playeridDIALOG_CLASSESPILOTSPAWNDIALOG_STYLE_LIST"Where you to want spawn ?""Las Venturas\nSan Fierro\nLos Santos""Select""Cancel");
                case 
1ShowPlayerDialog(playeridDIALOG_CLASSESTRUCKERSPAWNDIALOG_STYLE_LIST,"Where you to want spawn ?""Las Venturas\nSan Fierro\nLos Santos""Select""Cancel");
                case 
2SetPlayerPos(playerid,0.0,0.0,3.0);
                case 
3SetPlayerPos(playerid,0.0,0.0,3.0);
            }
        }
        return 
1;
    }
    if(
dialogid == DIALOG_CLASSESPILOTSPAWN)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0SetPlayerPos(playerid1319.7030,1262.4758,10.8472);
                case 
1SetPlayerPos(playerid, -1263.0552,31.6843,14.1484);
                case 
2SetPlayerPos(playerid2015.8444,-2445.6909,13.5469);
            }
        }
    }
    switch(
dialogid)
    {
        case 
LoginDialog:
        {
            if(!
responseKick(playerid);
            new
                
hashpass[129],
                
query[100],
                
playername[MAX_PLAYER_NAME];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            if(!
strcmp(hashpassPlayer[playerid][Password]))
            {
                
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
                
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
            }
            else
            {
                
SendClientMessage(playerid, -1"You have specified an incorrect password!");
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Login""Welcome player!\nYour account has been found in our database. Please fill in your password:""Login""Quit");
            }
        }
        case 
RegisterDialog:
        {
            if(!
response) return Kick(playerid);
            if(
strlen(inputtext) < 5)
            {
                
SendClientMessage(playerid, -1"Your password must at least contain more than 4 characters.");
                return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Register""Welcome player!\nYour account has not been registered yet. Please fill in your desired password:""Register""Quit");
            }
            new
                
query[512],
                
playername[MAX_PLAYER_NAME],
                
playerip[16];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerIp(playeridplayeripsizeof(playerip));
            
WP_Hash(Player[playerid][Password], 129inputtext);
            
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A);
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid);
        }
    }
    return 
1;

Reply
#4

As far as I can see there's nothing wrong with it. You get the player's name twice in OnPlayerConnect, which is redundant, but that in itself shouldn't cause a problem. Check the logs.
Reply
#5

fixed. i have write the wrong database.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)