27.06.2014, 12:34
pawn Код:
if (dialogid == REGISTER)
{
if (!response) return Kick(playerid);
if (response)
{
if (!strlen(inputtext))
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""RED">> "PREMIUM"Account Register", ""WHITE"Welcome to "RED"Extreme Street Fighters"WHITE"!\n"WHITE"This account is "RED"not "WHITE"registered.\n\n"YELLOW"» Please enter a password below to register.", "Register", "Quit");
return 1;
}
new hashpass[129], date[20], year, month, day, str[200];
new random_color = ( 16777216 * random( 256 ) ) + ( 65536 * random( 256 ) ) + ( 256 * random( 256 ) ) + 255;
WP_Hash(hashpass, sizeof(hashpass), inputtext);
getdate(year, month, day);
format(date, sizeof(date), "%d/%d/%d", day, month, year);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "Player's Data");
INI_WriteString(File, "Password", inputtext); //it wont hash password now if you want to hash it change "inputtext" to "hashpass"
INI_WriteString(File, "Registered_On", date);
INI_WriteInt(File,"Admin", 0);
INI_WriteInt(File,"VIP", 0);
INI_WriteInt(File,"Cash", 0);
INI_WriteInt(File,"Score", 0);
INI_WriteInt(File,"Kills", 0);
INI_WriteInt(File,"Deaths", 0);
INI_WriteInt(File, "Hours", 0);
INI_WriteInt(File, "Minutes", 0);
INI_Close(File);
gTotalRegisters++;
GivePlayerMoney(playerid, 100000);
PlayerInfo[playerid][Hours] = 0;
PlayerInfo[playerid][Minutes] = 0;
PlayerInfo[playerid][POS_X] = -2355.9038;
PlayerInfo[playerid][POS_Y] = -1635.4912;
PlayerInfo[playerid][POS_Z] = 483.7031;
PlayerInfo[playerid][Helmet] = 1;
SendClientMessage(playerid, COLOR_PINK, ""PREMIUM"*** "LIGHTBLUE"Thank you for registering your account!");
PlayerInfo[playerid][RegOn] = date;
SpawnPlayer(playerid);
format(str, sizeof(str), ""RED"[EsF] {%06x}%s(%d) {2BD9F8}has registered, making the server have total {008FFB}%d {2BD9F8}players registered.", random_color >>> 8, GetName(playerid), playerid, gTotalRegisters);
SetPlayerColor(playerid, random_color);
SendClientMessageToAll(0x2BD9F8FF, str);
new INI:FILE_SERVER_STATS = INI_Open(ServerStats);
INI_SetTag(FILE_SERVER_STATS, "Server_Statistics");
INI_WriteInt(FILE_SERVER_STATS, "Total_Registered_Users", gTotalRegisters);
INI_Close(FILE_SERVER_STATS);
PlayerInfo[playerid][Spawned] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
TD_MSG(playerid, 3000, "~b~~h~You have successfully registered!~w~~b~~h~~n~~b~~h~$100000 bonus for registering!");
new regInfo[300];
format(regInfo, sizeof(regInfo), ""YELLOW"Hello!\n\n"GREEN"» Your nick: "YELLOW"%s\n"GREEN"\n"GREEN"» Your password: "YELLOW"%s\n\n"LIGHTGREEN"Never share your password with anyone!\nYou'll need it for logging next time.", GetName(playerid), inputtext);
ShowPlayerDialog(playerid, DIALOG_CONFIRM_REGISTER, DIALOG_STYLE_MSGBOX, ""RED"Register Info", regInfo, "OK", "");
return 1;
}