this is when you do not have an account and you are forced to register and login
PHP код:
format(nstring, sizeof(nstring), "Jucători/%s.ini", plname);
if(fexist(nstring))
{
gPlayerAccount[playerid] = 1;
GetPlayerIp(playerid, ipjucator, sizeof(ipjucator));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "{FFFFFF}Bine ai revenit pe Play Arena {7FFFD4}%s {FFFFFF}!\n{FFFFFF}IP: {7FFFD4}%s\n{FFFFFF}Acest nume este deja оnregistrat !\n{FFFFFF}Te rog scrie parola оn căsuta de mai jos pentru a putea intra оn joc:", sendername, ipjucator);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{FFFFFF}Conectare", string,"{FFFFFF}Conectare", "{FFFFFF}Quit"); //login
}
else
{
gPlayerAccount[playerid] = 0;
GetPlayerIp(playerid, ipjucator, sizeof(ipjucator));
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerHealth(playerid, 100);
format(string, sizeof(string), "{FFFFFF}Bine ai venit pe Play Arena {7FFFD4}%s {FFFFFF}!.\n{FFFFFF}IP: {7FFFD4}%s\n{FFFFFF}Pentru a te putea inregistra,scrie o parolă оn căsuta de mai jos pentru a putea continua:", sendername, ipjucator);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{FFFFFF}Оnregistrare", string, "{FFFFFF}Inregistrare","{FFFFFF}Quit");
}
this is public OnDialogResponse callback
PHP код:
if(dialogid == 2 || dialogid == 3)
{
if(response)
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerLogin(playerid,tmppass);
new playersip[24];
GetPlayerIp(playerid, playersip, sizeof(playersip));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
SetPlayerPos(playerid, 1964.8954, -1305.2051 ,53.4559);
}
else
{
ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Login", "{FFFFFF}Aceasta parola nu este corecta. Mai оncearcă o dată:","Login","Exit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 3)
{
SendClientMessage(playerid, COLOR_WHITE , "{FA8072}ConsolaJucator: {FFFFFF}Ai luat kick pentru ca ai bagat parola de 3 ori gresita !" );
Kick(playerid);
}
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"{FA8072}ConsolaJucator: {FFFFFF} Ai primit kick pentru ca ai dat exit !");
Kick(playerid);
return 1;
}
}
if(dialogid == 1)
{
if(response)
{
if(strlen(inputtext))
{
format(string, sizeof(string), "Jucători/%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if(hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "Acest nume este luat,alege altul.");
fclose(hFile);
return 1;
}
if(strlen(inputtext) < 4 )
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"{FFFFFF}Ne pare rău {006400}%s {FFFFFF}!\n{FFFFFF}Parola ta trebuie sa contina minim 4 caractere:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"{FFFFFF}Register", regstring, "{FFFFFF}Register", "{FFFFFF}Exit");
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerRegister(playerid,tmppass);
}
else
{
new regname[64];
new regstring[128];
GetPlayerIp(playerid, ipjucator, sizeof(ipjucator));
GetPlayerName(playerid, regname, sizeof(regname));
format(regstring, sizeof(regstring), "{FFFFFF}Bine ai venit pe Play Arena {7FFFD4}%s {FFFFFF}!.\n{FFFFFF}IP: {7FFFD4}%s\n{FFFFFF}Pentru a te putea inregistra,scrie o parolă оn căsuta de mai jos pentru a putea continua:", regname, ipjucator);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{FFFFFF}Оnregistrare", regstring, "{FFFFFF}Inregistrare","{FFFFFF}Quit");
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"Ai primit kick pentru ca ai dat exit !");
Kick(playerid);
return 1;
}
}