22.06.2016, 13:54
Try this. Added an else statement.
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CLASS_POLICIER)
{
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, 22, 9999);
}
}
switch(dialogid)
{
case LoginDialog:
{
if(!response) Kick(playerid);
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) return Kick(playerid);
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;
}