Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerLogin(playerid, type, password[])
- {
- mysql_store_result(mCon);
- if(!type)
- {
- if(!mysql_num_rows(mCon))
- {
- SendClientMessage(playerid,COLOR_ERROR,"Error, (/register) first."), mysql_free_result(mCon);
- ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Please register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
- return 1;
- }
- mysql_real_escape_string(password, password);
- new pass[129];
- WP_Hash(pass, 129, password);
- new query[128+129];
- format(query, sizeof(query), "SELECT * FROM `users` WHERE `Name` = '%s' AND `Password` = '%s' LIMIT 1",PlayerInfo[playerid][pName], pass);
- mysql_function_query(mCon, query, false, "OnPlayerLogin", "dd", playerid, 1);
- }
- if(type)
- {
- if(!mysql_num_rows(mCon))
- {
- SendClientMessage(playerid,COLOR_ERROR,"Error, incorrect password");
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
- return 1;
- }
- new result[256];
- mysql_fetch_row(result);
- sscanf(result, "p<|>{s[25]s[130]}i",PlayerInfo[playerid][pAdminLevel]);
- PlayerInfo[playerid][pLogged] = 1;
- }
- mysql_free_result(mCon);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement