[Ajuda] GetDate
#1

Bom galera, estou com essa porcaria de problema:

Code:
	    case DIALOG_REGISTER:
	    {
	        new
	            string[200],
	            hashpass[129]
			;
			if(response)
			{
		        if(!IsValidPassword(inputtext))
		        {
        			ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", ""grey"Welcome to the JaKe's Stunt/DM/Freeroam/Minigames/Roleplay.\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Invalid password symbol.", "Register", "Quit");
		            return 1;
		        }
		        if (strlen(inputtext) < 6 || strlen(inputtext) > 20)
		        {
        			ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", ""grey"Welcome to the JaKe's Stunt/DM/Freeroam/Minigames/Roleplay.\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Password length shouldn't go below 4 and shouldn't go higher 20.", "Register", "Quit");
		            return 1;
		        }

		        WP_Hash(hashpass, 129, inputtext);

		        SetPlayerScore(playerid, 0);
		        GivePlayerCash(playerid, 50000);
		        User[playerid][accountScore] = 0;
		        User[playerid][accountCash] = 50000;

		        //Time = Hours, Time2 = Minutes, Time3 = Seconds
		        new time, time2, time3;
		        gettime(time, time2, time3);
		        new date, date2, date3;
		        //Date = Month, Date2 = Day, Date3 = Year
		        getdate(date, date2, date3);

		        format(User[playerid][accountDate], 150, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);

				new
					query[1400]
				;
			    format(query, sizeof(query),
				"INSERT INTO `users` (`username`, `IP`, `joindate`, `password`, `description`, `admin`, `helper`, `vip`, `expirevip`, `kills`, `deaths`, `math`, `mb`, `cp`, `react`, `score`, `money`, `hours`, `minutes`, `seconds`, `premiumpoints`, `muted`, `mutesec`, `cmuted`, `cmutesec`, `warnings`, `jail`, `jailsec`, `rated`, `hs`, `sskin`, `uskin`, `wet`) VALUES ('%s','%s','%s','%s','Server Player',0,0,0,0,0,0,0,0,0,0,%d,%d,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)",\
					GetName(playerid),
					User[playerid][accountIP],
					User[playerid][accountDate],
					hashpass,
					User[playerid][accountScore],
					User[playerid][accountCash]
			 	);
			 	
			 	format(User[playerid][accountDescp], 100, "Server Player");

			 	User[playerid][accountNoB] = 1;
			 	
				db_query(Database, query);
			    format(query, sizeof(query),
				"INSERT INTO `premium` (`username`, `jetpack`, `brake`, `brakeset`, `namechange`, `changewait`) VALUES ('%s',0,0,1,0,0)",\
					GetName(playerid),
					User[playerid][accountJP]
			 	);
				db_query(Database, query);

				User[playerid][accountLogged] = true;

				PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

			    new
			        count,
			        DBResult: result
				;
			    result = db_query(Database, "SELECT * FROM `users`");
			    count = db_num_rows(result);
			    
			    if(count == 1)
			    {
			        format(sInfo[first_person], 256, "%s", GetName(playerid));
			    }
			    
			    format(sInfo[last_person], 256, "%s", GetName(playerid));
		        format(sInfo[when_person], 256, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);

				savestatistics();
    			format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(GetName(playerid)));
			    result = db_query(Database, query);
				if(db_num_rows(result))
				{
	    			db_get_field_assoc(result, "userid", query, 7);
	    			User[playerid][accountID] = strval(query);
			    }
				SendClientMessage(playerid, -1, "» "green"You have successfully registered from the database.");
				format(string, sizeof(string), "» {%06x}%s(%d) "white"has just registered "white"in the server, Overall we got "grey"%d "white"players registered.", GetPlayerColor(playerid) >>> 8, GetName(playerid), playerid, count);
				SendClientMessageToAll(-1, string);
			    db_free_result(result);
			}
			else
			{
			    KickDelay(playerid);
			}
	    }
	    case DIALOG_LOGIN:
	    {
	        new
	            hashp[129],
	            string[256+256]
			;
			if(response)
			{
			    WP_Hash(hashp, 129, inputtext);
			    if(!strcmp(hashp, User[playerid][accountPassword], false))
			    {
			        LoginPlayer(playerid);
			        LoginPremium(playerid);
			    }
			    else
			    {
			        User[playerid][WarnLog]++;

			        if(User[playerid][WarnLog] == 3)
			        {
						ShowPlayerDialog(playerid, N, DIALOG_STYLE_MSGBOX, ""red"Kicked", ""grey"You have been kicked from the server having too much wrong passwords!\nTry again, Reconnect (/q then join to the server again.)", "Close", "");
						KickDelay(playerid);
						return 1;
			        }

			        format(string, sizeof(string), "Invalid password! "white"- "grey"%d out of 3 Warning Log Tires.", User[playerid][WarnLog]);
			        SendClientMessage(playerid, COLOR_RED, string);

			        format(string, sizeof(string), ""grey"Welcome back to JaKe's Stunt/DM/Freeroam/Minigames/Roleplay.\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and use another username.\nERROR: Wrong password (%d/3 Warnings Log)", User[playerid][WarnLog]);
        			ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Quit");
			    }
			}
			else
			{
			    KickDelay(playerid);
			}
		}
	}
Em GETDATE
quero colocar em ordem (dia / mes / ano) = (date2 / date / date3)

Mas ao trocar ele inverte tudo e nгo da certo, sei lб o que acontece!
Reply
#2

PHP Code:
new diamesano;
getdate(anomesdia);

//
format(stringsizeof string"%02d/%02d/%04d"diamesano); 
Reply
#3

Quote:
Originally Posted by zPain
View Post
PHP Code:
new diamesano;
getdate(anomesdia);
//
format(stringsizeof string"%02d/%02d/%04d"diamesano); 
Deu certinho, tipo, vc colocou a variбvel ao contrario da funзгo pegar data e funfou de boa. Como isso?
Reply
#4

Quote:
Originally Posted by F1N4L
View Post
Deu certinho, tipo, vc colocou a variбvel ao contrario da funзгo pegar data e funfou de boa. Como isso?
Olб F1N4L, getdate tem o seguinte parвmetro:
PHP Code:
getdate(yearmonthday)
year Ano
month 
Mкs
day 
Dia 
Nгo й preciso falar mais nada nй?!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)