Scripting help
#9

Try this.

Код:
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 date[20], year, month, day, str[200];
			new    random_color = ( 16777216 * random( 256 ) ) + ( 65536 * random( 256 ) ) + ( 256 * random( 256 ) ) + 255;
			
 			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);
			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;
		}
	}
	if (dialogid == LOGIN)
	{
	    if (!response) return Kick(playerid);
	    if (response)
	    {
	       
	       
	       if(!strcmp( PlayerInfo[playerid][Password],inputtext, false))
	       {
				new str[250], AdminRank[50], msg[128], str2[128];
	            INI_ParseFile(UserPath(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
	            SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
	            GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
	            SetPlayerColor(playerid, PlayerInfo[playerid][Color]);
				switch(PlayerInfo[playerid][Admin])
				{
				    case 1: AdminRank = "Moderator";
					case 2: AdminRank = "Administrator";
					case 3: AdminRank = "Head Administrator";
					case 4: AdminRank = "Server Owner";
				}
				if (PlayerInfo[playerid][VIP] >= 1 && isnull(PlayerInfo[playerid][AltName]))
				{
					format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}{87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid);
    				SendClientMessageToAll(-1, msg);
				}
   				else if (PlayerInfo[playerid][VIP] >= 1)
				{
    				format(msg, sizeof(msg), "{FFD700}[EsF] {87F5EA}VIP {%06x}%s(%d) {A1D4CF}(%s) {87F5EA}has logged in.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid, PlayerInfo[playerid][AltName]);
   					SendClientMessageToAll(-1, msg);

				}
				if (PlayerInfo[playerid][Admin] >= 1)
				{
					format(msg, sizeof(msg), "{FFD700}[EsF] {DEF968}%s {%06x}%s(%d) {DEF968}has logged in.", AdminRank, (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid);
					SendClientMessageToAll(-1, msg);
				}
				format(str, sizeof(str), "** Welcome back, %s! You were last online on {CB6CE6}%s{FFB6C1}!", GetName(playerid), lastactive[playerid]);
				SendClientMessage(playerid, COLOR_PINK, str);
				format(str2, sizeof(str2), "** You have been online for %i hours and %i minutes in total.", PlayerInfo[playerid][Hours], PlayerInfo[playerid][Minutes]);
				SendClientMessage(playerid, 0xFFD70075, str2);
				TD_MSG(playerid, 3000, "~b~~h~Welcome back!~n~~b~~h~You have successfully logged in!");
				SpawnPlayer(playerid);
				gOnlineTime = SetTimerEx("TimeOnServer", 60000, true, "i", playerid);
				PlayerInfo[playerid][Spawned] = 1;
				PlayerInfo[playerid][LoggedIn] = 1;
	       }
Reply


Messages In This Thread
Scripting help - by kirostar - 29.06.2014, 02:52
Re: Scripting help - by KillerStrike23 - 29.06.2014, 02:55
Re: Scripting help - by kirostar - 29.06.2014, 02:56
Re: Scripting help - by Laurey - 29.06.2014, 03:29
Re: Scripting help - by kirostar - 29.06.2014, 03:53
Re: Scripting help - by Laurey - 29.06.2014, 04:06
Re: Scripting help - by kirostar - 29.06.2014, 04:08
Re: Scripting help - by kirostar - 29.06.2014, 04:35
Re: Scripting help - by Rittik - 29.06.2014, 05:18
Re: Scripting help - by kirostar - 29.06.2014, 05:43

Forum Jump:


Users browsing this thread: 1 Guest(s)