help dialog
#1

Hi all , i have a little problem with dialog when the player login/register one time and when he spawn it show a dialog(see the code) and after the dialog the player must login/register again here is the code :

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_CLASS_POLICIER)
    {
         switch(
listitem)
        {
            case 
0GivePlayerWeapon(playerid229999);
        }
    }
     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"Tu as entrйe un mauvais mot de pass!");
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Connection""Bonjour!\nVous etes dйjа enregistrer. si te plait connecte toi:""Login""Quit");
            }
        }
        case 
RegisterDialog:
        {
            if(!
response) return Kick(playerid);
            if(
strlen(inputtext) < 5)
            {
                
SendClientMessage(playerid, -1"Ton mot de pass doit avoir au moin 4 caractиres.");
                return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Enregistrement""Bonjour!!\nTon compte n'est pas enregistrer connecte toi avec un mot de pass de ton choix:""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`, `Level`, `Infamie`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0, 0)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A);
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid);
        }
    }
    return 
1;

thank for help
Reply
#2

Please show your onPlayerSpawn() method. The problem must be there.
Reply
#3

here it is :
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
gTeam[playerid] == TEAM_POLICIER)
    {
      
SetPlayerPos(playerid1551.7479,-1675.5494,15.9859);
      
SetPlayerFacingAngle(playerid90);
      
SetPlayerSkin(playerid284);
      
ShowPlayerDialog(playeridDIALOG_CLASS_POLICIERDIALOG_STYLE_LIST"Toutes les classes policiers""Policier\nSwat\nFBI\nBuldozer\nCloacker\n""Selectionner""Fermйe");
    }
    return 
1;

Reply
#4

What are your dialog ids? ( DIALOG_CLASS_POLICIER, LoginDialog and RegisterDialog)
Reply
#5

Try this. Added an else statement.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) 

    if(
dialogid == DIALOG_CLASS_POLICIER
    { 
         switch(
listitem
        { 
            case 
0GivePlayerWeapon(playerid229999); 
        } 
    } 
     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"Tu as entrйe un mauvais mot de pass!"); 
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Connection""Bonjour!\nVous etes dйjа enregistrer. si te plait connecte toi:""Login""Quit"); 
            } 
        } 
        case 
RegisterDialog
        { 
            if(!
response) return Kick(playerid); 
            if(
strlen(inputtext) < 5
            { 
                
SendClientMessage(playerid, -1"Ton mot de pass doit avoir au moin 4 caractиres."); 
                return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Enregistrement""Bonjour!!\nTon compte n'est pas enregistrer connecte toi avec un mot de pass de ton choix:""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`, `Level`, `Infamie`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0, 0)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A); 
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid); 
        } 
    } 
    return 
1

Reply
#6

Quote:
Originally Posted by mjay768
Посмотреть сообщение
Try this. Added an else statement.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) 

    if(
dialogid == DIALOG_CLASS_POLICIER
    { 
         switch(
listitem
        { 
            case 
0GivePlayerWeapon(playerid229999); 
        } 
    } 
     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"Tu as entrйe un mauvais mot de pass!"); 
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT"Connection""Bonjour!\nVous etes dйjа enregistrer. si te plait connecte toi:""Login""Quit"); 
            } 
        } 
        case 
RegisterDialog
        { 
            if(!
response) return Kick(playerid); 
            if(
strlen(inputtext) < 5
            { 
                
SendClientMessage(playerid, -1"Ton mot de pass doit avoir au moin 4 caractиres."); 
                return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT"Enregistrement""Bonjour!!\nTon compte n'est pas enregistrer connecte toi avec un mot de pass de ton choix:""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`, `Level`, `Infamie`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0, 0)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A); 
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid); 
        } 
    } 
    return 
1

not working
Reply
#7

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
    if(dialogid == DIALOG_CLASS_POLICIER) 
    { 
		if(response)
		{
			switch(listitem) 
			{ 
				case 0: GivePlayerWeapon(playerid, 22, 9999); 
			} 
		}
    } 
	
    switch(dialogid) 
    { 
        case LoginDialog: 
        { 
            if(!response) Kick(playerid); 
			else {
				new hashpass[129], query[100], playername[MAX_PLAYER_NAME]; 
				GetPlayerName(playerid, playername, sizeof(playername)); 
				WP_Hash(hashpass, sizeof(hashpass), inputtext); 
				if(!strcmp(hashpass, Player[playerid][Password])) 
				{ 
					mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername); 
					mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid); 
				} 
				else 
				{ 
					SendClientMessage(playerid, -1, "Tu as entrйe un mauvais mot de pass!"); 
					ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Connection", "Bonjour!\nVous etes dйjа enregistrer. si te plait connecte toi:", "Login", "Quit"); 
				} 
			}
        } 
        case RegisterDialog: 
        {
            if(!response) Kick(playerid); 
			else {
				if(strlen(inputtext) < 5)
				{ 
					SendClientMessage(playerid, -1, "Ton mot de pass doit avoir au moin 4 caractиres."); 
					return ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Enregistrement", "Bonjour!!\nTon compte n'est pas enregistrer connecte toi avec un mot de pass de ton choix:", "Register", "Quit"); 
				} 
				new query[512], playername[MAX_PLAYER_NAME], playerip[16]; 
				GetPlayerName(playerid, playername, sizeof(playername)); 
				GetPlayerIp(playerid, playerip, sizeof(playerip)); 
				WP_Hash(Player[playerid][Password], 129, inputtext); 
				mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `Level`, `Infamie`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0, 0)", playername, Player[playerid][Password], playerip, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A); 
				mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid); 
			}
		}
    } 
    return 1; 
}
Reply
#8

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
    if(dialogid == DIALOG_CLASS_POLICIER) 
    { 
		if(response)
		{
			switch(listitem) 
			{ 
				case 0: GivePlayerWeapon(playerid, 22, 9999); 
			} 
		}
    } 
	
    switch(dialogid) 
    { 
        case LoginDialog: 
        { 
            if(!response) Kick(playerid); 
			else {
				new hashpass[129], query[100], playername[MAX_PLAYER_NAME]; 
				GetPlayerName(playerid, playername, sizeof(playername)); 
				WP_Hash(hashpass, sizeof(hashpass), inputtext); 
				if(!strcmp(hashpass, Player[playerid][Password])) 
				{ 
					mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername); 
					mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid); 
				} 
				else 
				{ 
					SendClientMessage(playerid, -1, "Tu as entrйe un mauvais mot de pass!"); 
					ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Connection", "Bonjour!\nVous etes dйjа enregistrer. si te plait connecte toi:", "Login", "Quit"); 
				} 
			}
        } 
        case RegisterDialog: 
        {
            if(!response) Kick(playerid); 
			else {
				if(strlen(inputtext) < 5)
				{ 
					SendClientMessage(playerid, -1, "Ton mot de pass doit avoir au moin 4 caractиres."); 
					return ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Enregistrement", "Bonjour!!\nTon compte n'est pas enregistrer connecte toi avec un mot de pass de ton choix:", "Register", "Quit"); 
				} 
				new query[512], playername[MAX_PLAYER_NAME], playerip[16]; 
				GetPlayerName(playerid, playername, sizeof(playername)); 
				GetPlayerIp(playerid, playerip, sizeof(playerip)); 
				WP_Hash(Player[playerid][Password], 129, inputtext); 
				mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `Level`, `Infamie`) VALUES ('%e', '%e', '%e', 0, 0, 0, 0, 0)", playername, Player[playerid][Password], playerip, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A); 
				mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid); 
			}
		}
    } 
    return 1; 
}
Not working
Reply
#9

If only you'd read my reply...
Reply
#10

you got the response...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)