P-GaMinG CommuniTy
Welcome To Community!


Welcome To GaMinG
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Cum faci Register cu ajutoru la Dialog

Go down 
AuthorMessage
cristian
Admin
avatar

Mesaje : 109
Data de inscriere : 2011-03-12
Varsta : 22
Localizare : Buzau

PostSubject: Cum faci Register cu ajutoru la Dialog   Sat Mar 12, 2011 9:09 am

Cum faci Register cu ajutoru la Dialog
Cum faci Register cu ajutoru la Dialog


1.Intrati in GM(GameMode). Dati CTRL+F si scrieti public OnPlayerConnect. Dupa ce lati gasit va duceti jos de tot unde ar trebui sa fie codu urmator.


Cod:
SendClientMessage(playerid, COLOR_YELLOW, "SERVER: That nick is registered, please login");SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now login by typing /login <password>");



Dupa cel gasiti il inlocuiti cu urmatorul.


Cod:
new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"Welcome, %s\nThat nick is registered.\nYou can now login:",loginname);ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");




2.Acum mai jos va fi functia de register cu codu urmator.


Cod:
SendClientMessage(playerid,COLOR_YELLOW,"You dont have an account. Please register by using /register [password]");



Pasta il inlocuiti cu:


Cod:
new regstring[128];new regname[64];GetPlayerName(playerid,regname,sizeof(regname));format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");




3.Acum cautam OnPlayerRequestClass cu ajutoru la CTRL+F. Aici nu trebuie nimic modificat decat adaugat.
Adaugam codu urmator:


Cod:
if (gPlayerAccount[playerid] != 0){new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"Welcome, %s\nThat nick is registered.\nYou can now login:",loginname);ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");}else{gPlayerAccount[playerid] = 0;new regstring[128];new regname[64];GetPlayerName(playerid,regname,sizeof(regname));format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");}



Sa fie la inceputul functiei ex.


Cod:
public OnPlayerRequestClass(playerid, classid){if (gPlayerAccount[playerid] != 0){new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"Welcome, %s\nThat nick is registered.\nYou can now login:",loginname);ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");}else{gPlayerAccount[playerid] = 0;new regstring[128];new regname[64];GetPlayerName(playerid,regname,sizeof(regname));format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");}....return 1;}




4.Acum cautam OtherTimer() . Acum cautati codu urmator mai jos.


Cod:
SendClientMessage(i, COLOR_WHITE, "HINT: You can now login by typing /login <password>");



Pasta il inlocuim cu:


Cod:
new loginname[64];new loginstring[128];GetPlayerName(i,loginname,64);format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);ShowPlayerDialog(i,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");




5.Acum cautam OnPlayerRegister. Dupaia dati mai in jos si veti gasi codul asta:


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



Pasta il inlocuiti cu :


Cod:
new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");




6.Acum cautam OnPlayerLogin. Cautam mai jos codu urmator:


Cod:
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password does not match your name.");



Pasta il inlocuim cu :


Cod:
new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");




7.Acum cred ca uni au functia OnDialogResponse. Daca o aveti adaugati urmatorul cod


Cod:
new sendername[MAX_PLAYER_NAME];new string[128];if(response){if(dialogid == 12346 || dialogid == 12347){if(strlen(inputtext)){new tmppass[64];strmid(tmppass, inputtext, 0, strlen(inputtext), 255);//Encrypt(tmppass);OnPlayerLogin(playerid,tmppass);}else{new loginstring[128];new loginname[64];GetPlayerName(playerid,loginname,sizeof(loginname));format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");gPlayerLogTries[playerid] += 1;if(gPlayerLogTries[playerid] == 5) { Ban(playerid); }}}if(dialogid == 12345){if(strlen(inputtext)){GetPlayerName(playerid, sendername, sizeof(sendername));format(string, sizeof(string), "GF/%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 tmppass[64];strmid(tmppass, inputtext, 0, strlen(inputtext), 255);//Encrypt(tmppass);OnPlayerRegister(playerid,tmppass);}else{new regstring[128];new regname[64];GetPlayerName(playerid,regname,sizeof(regname));format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");}}}else{Kick(playerid);}




Daca nul aveti adaugati asta http://pastebin.com/XXhpunqq
Back to top Go down
View user profile http://p-games.formyjob.net
 
Cum faci Register cu ajutoru la Dialog
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
P-GaMinG CommuniTy :: P-gaming - SA:MP :: Tutoriale-
Jump to: