Exiled - Gaming Romania este o comunitate bazata pe gaming-ul profesionist.


Cum sa faci register cu ajutorul Dialog

 



Vezi subiectul anterior Vezi subiectul urmator In jos   Mesaj • Pagina 1 din 1

Dyzzy
#1

la data de Sam Ian 19, 2013 10:30 pm

avatar
Exiled Skill +2
Exiled Skill +2
[TUT][0.3]Cum faci Register cu ajutoru la Dialog[UP]

1.Cautam linia:


Cod:
if(fexist(string))
{
gPlayerAccount[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "SERVER: That nick is registered, please login");
SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now login by typing /login ");
return 1;
}
else
{
gPlayerAccount[playerid] = 0;
SendClientMessage(playerid,COLOR_YELLOW,"You dont have an account. Please register by using /register [password]");
return 1;
}

Si o inlocuim cu:



Cod:
if(fexist(string))
{
gPlayerAccount[playerid] = 1;
new loginstring[2000];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Salut, {FF0000}%s {FFFFFF}! Bine ai venit.\n{FFFFFF}Esti inregistrat in baza noastra de dare.\n{FFFFFF}\n\n\n\n\n{FFFF00}NumeSV {FFFFFF}te roaga sa te loghezi:",loginname);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"{FF0000}Login",loginstring,"Login","Exit");
return 1;
}
else
{
gPlayerAccount[playerid] = 0;
new regstring[1000];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Bun venit, {1E90FF}%s\n{FFFFFF}Nu ai cont.\n\n\n\n\n\n{FFFF00}NumeSV te roaga sa te inregistrezi:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"{FF0000}Register",regstring,"Register","Exit");
return 1;
}


2.Cautam linile:


Cod:
if(SafeTime[i] == 1)
{
if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
{
SendClientMessage(i, COLOR_WHITE, "HINT: You can now login by typing /login ");
}
}


Si inlocuim cu:



Cod:
if(SafeTime[i] == 1)
{
if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
{
new loginname[64];
new loginstring[128];
GetPlayerName(i,loginname,64);
format(loginstring,sizeof(loginstring),"Bun venit, %s\nTe rugam sa te loghezi:",loginname);
ShowPlayerDialog(i,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
}
}


3.Cautam linile:


Cod:
fclose(hFile);
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you can login now (/login [password]).");


Si inlocuim cu:



Cod:
fclose(hFile);
new loginstring[3000];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Salut, {FF0000}%s {FFFFFF}! Teai inregistrat un cont,.\n{FFFFFF}Acum e momentul sa te loghezi.\n{FFFF00}NumeSV {FFFFFF}te roaga sa te loghezi:",loginname);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"{FF0000}Login",loginstring,"Login","Exit");


4.Cautam linile:


Cod:
else
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password does not match your name.");
fclose(UserFile);
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
return 1;
}


Si inlocuim cu


Cod:
else
{
new loginstring[500];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FF0000}WRONG PASSWORD\n\n\n\n\n{FFFF00}IronRp{FFFFFF} te roaga sa scri parola corecta:",loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"{FF0000}Log-in",loginstring,"Log-in","Exit");
fclose(UserFile);
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
return 1;
}


5.Acum avem dialogurile create. Urmeaza sa adaugam dialogurile si la OnDialogResponse.
-Mai intai cautati OnDialogResponse.
-Sub { adaugam urmatoarele coduri:

Cod:

new sendername[MAX_PLAYER_NAME];
if(dialogid == 12346 || dialogid == 12347)
{
if(response)
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerLogin(playerid,tmppass);
}
else
{
new loginstring[500];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FF0000}WRONG PASSWORD\n\n\n\n\n{FFFF00}NumeSV{FFFFFF} te roaga sa scri parola corecta:",loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"{FF0000}Log-in",loginstring,"Log-in","Exit");
}
}
}

if(dialogid == 12345)
{
if(response)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
fclose(hFile);
return 1;
}
new passtring[128];
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
format(passtring,sizeof(passtring),"{FFFFFF}Your password is( {FF0000}%s {FFFFFF}).Please don't forget your password or you lost the account",tmppass);
SendClientMessage(playerid, COLOR_ROSUAPRINS, passtring);
OnPlayerRegister(playerid,tmppass);
}
else
{
new regstring[1000];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Bun venit, {1E90FF}%s\n{FFFFFF}Nu ai cont.\n\n\n\n\n\n{FFFF00}NumeSV te roaga sa te inregistrezi:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"{FF0000}Register",regstring,"Register","Exit");
}
}
}


6.Acum trebuie sa dezactivam comenzile /register & /login.
-Cautam comanda /register si o "bagam" intre /* si */ .
--Aveti grija ca comanda sa "fie" verde.
-Cautam comanda /login si facem lafel cum e sus.

ATENTIE
-Nu este chear un tutorial ci o mai mult iti arat cum sa inlocui.
-Cui nui place "munca" mea sa nu posteze.
-Nu vreau sa vad acest tutorial pe alte forumi fara acordu meu (il cereti prin PM).

CREDIT
-Tutorial By:Dyzzi(me)

Vezi profilul utilizatorului
z3!uSs
#2

la data de Joi Ian 24, 2013 7:05 pm

avatar
Exiled Skill +4
Exiled Skill +4
Wo bv Dyzzy



ELIMINAT
Vezi profilul utilizatorului
Dev1l
#3

la data de Joi Ian 24, 2013 7:10 pm

avatar
Exiled Skill +4
Exiled Skill +4
Ai warn deoarece l-am vzt pe alt forum
Si este warn serios..
T&C



Viata este ca mersul pe bicicleta ,
Incearca sa-ti mentii echilibru.


Us 24
Vezi profilul utilizatorului
Adi
#4

la data de Joi Ian 24, 2013 8:17 pm

avatar


Dev1l nu are nici o treaba daca este pe alt forum...problema este ca trebuie sa tina Sursa de unde l-0a luat dar vad ca el nu a facut asa ceva asa ca merita WARN



Vezi profilul utilizatorului http://forumul-exiled.forumgratuit.ro
Continut sponsorizat
#5


Vezi subiectul anterior Vezi subiectul urmator Sus   Mesaj • Pagina 1 din 1