pawn Код:
// on dialog register & login
case DIALOG_REGISTER:
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You have to register to play in "NAME"","Close","");
Kick(playerid);
}
if(response)
{
new str[256];
if(!strlen(inputtext))
{
format(str,sizeof(str),""chat"Welcome %s to "NAME"",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,str,""chat" Welcome to "NAME" you'll be forced to register please click register!","Register","Quit");
}
new stringa[500];
new query[128], nome[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, 24);
if(strfind(nome, TAGADMIN, true) == 0)
{
format(stringa, sizeof(stringa), "{FFFFFF}Username {FF4444}%s{FFFFFF}!\nYou must confirm the password protection {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGADMIN, DIALOG_STYLE_INPUT, "{33AA33}Admin Panel", stringa, "Confirm", "Exit");
}
WP_Hash(pInfo[playerid][pPassword], 129, inputtext);
mysql_format(mysql, query, sizeof(query), "INSERT INTO `zmusers` (`Username`, `Password`) VALUES ('%e', '%s')", PlayerName(playerid), pInfo[playerid][pPassword]);
mysql_tquery(mysql, query, "CreateAkun", "i", playerid);
printf("[DEBUG HASH PASS] : %s",pInfo[playerid][pPassword]);
pInfo[playerid][pLogged] = 1;
}
}
case DIALOG_LOGIN:
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must log-in to play in "NAME"","Close","");
Kick(playerid);
}
if(response)
{
new buf[129];
WP_Hash(buf, sizeof(buf), inputtext);
if(!strcmp(buf,pInfo[playerid][pPassword]))
{
new stringa[500];
new nome[24], query[128];
GetPlayerName(playerid, nome, 24);
if(strfind(nome, TAGADMIN, true) == 0)
{
format(stringa, sizeof(stringa), "{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the password admin {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the admin password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGADMIN, DIALOG_STYLE_INPUT, "{33AA33}admin", stringa, "Confirm", "Exit");
}
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `zmusers` WHERE `Username` = '%e' LIMIT 1", PlayerName(playerid));
mysql_tquery(mysql, query, "LoadAkun", "i", playerid);
pInfo[playerid][pLogged] = 1;
SendClientMessage(playerid,-1,""chat""COL_LGREEN" You have successfully logged in ");
SendClientMessage(playerid,-1,""chat""COL_LGREEN" Press Spawn to start play!");
}
else
{
new string[256];
format(string,sizeof(string),""chat" Login Panel ",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,string,""chat" system detects you have already registered, please login","Login","Quit");
}
}
}