UnioGame
Pentru a vedea continutul Forumului trebuie sa te inregistrezi !
Multumim.
Cautam Administratori,Super-Moderatori,Moderatori si Designeri , pentru detalii vizitati Sectiunea Anunturi ale Forumului.

Pentru mai multe informatii add madalinadrian76@yahoo.com
UnioGame
Pentru a vedea continutul Forumului trebuie sa te inregistrezi !
Multumim.
Cautam Administratori,Super-Moderatori,Moderatori si Designeri , pentru detalii vizitati Sectiunea Anunturi ale Forumului.

Pentru mai multe informatii add madalinadrian76@yahoo.com


HostName: Alpha RPG | /bonus | Oferim Helper/Lider - 30 ON! Address: 93.119.26.46:7777
 
Caut Staff si dau grade !

Distribuiţi|

[0.3]Cum faci Register cu ajutoru la Dialog[UP]

Vezi subiectul anterior Vezi subiectul urmator In jos
AutorMesaj
Tudo
Fondator
Tudo


Rank: Fondator
Mesaje : 584
Varsta : 28
Localizare : Tandarei Jud.Ialomita
Stare de spirit : Happy

EVIL.SYTES.NET
Connect EVIL.SYTES.NET: [0.3]Cum faci Register cu ajutoru la Dialog[UP]  Empty
MesajSubiect: [0.3]Cum faci Register cu ajutoru la Dialog[UP] [0.3]Cum faci Register cu ajutoru la Dialog[UP]  EmptyMar Feb 26, 2013 4:19 pm

[TUT][0.3]Cum faci Register cu ajutoru la Dialog[UP]

1.Cautam linia:
Code: [Select]

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:

Code: [Select]

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:
Code: [Select]

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:

Code: [Select]

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:
Code: [Select]

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


Si inlocuim cu:

Code: [Select]

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:
Code: [Select]

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
Code: [Select]

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:
Code: [Select]

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:IcE(me)
-Functile de dialog gasite in postul original de la gm-u GF. (editat de mine)


Acesta nu este postu original, am facut un update la el deoarece vechea medoda nu e era chear buna.
Sus In jos
http://board.uniogame.com

[0.3]Cum faci Register cu ajutoru la Dialog[UP]

Vezi subiectul anterior Vezi subiectul urmator Sus

Subiecte similare

-
t [Ghid]Cum sa faci lv 65 rpd
t Cum Sa Faci Un Server De metin2
t Cum faci crafting pe minecraft?
t Cum sa faci un CD/DVD zgariat sa functioneze
t Cum sa faci RANKS/VIP/LEVEL
Pagina 1 din 1

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
UnioGame :: Resurse Generale ::   SAMP :: Tutoriale-