Registration date mysql -
Face9000 - 02.01.2017
I'm trying to save registration date of the player on the registration, i made this:
Код:
new date[3];
getdate(date[2], date[1], date[0]);
new month[15];
switch (date[1])
{
case 1: month = "January";
case 2: month = "Feburary";
case 3: month = "March";
case 4: month = "April";
case 5: month = "May";
case 6: month = "June";
case 7: month = "July";
case 8: month = "August";
case 9: month = "September";
case 10: month = "October";
case 11: month = "November";
case 12: month = "December";
}
new register_on[25];
format(register_on, sizeof(register_on), "%02d %s, %d", date[0], month, date[2]);
SQL::WriteString(handle, "p_regdate", UserInfo[playerid][p_regdate], date[0], month, date[2]);
But got errors.
Also another question, do i need to save the UserInfo[playerid][p_regdate] on player disconnect and load it on login or is not necessary? Thanks.
Re: Registration date mysql -
oMa37 - 02.01.2017
1. What errors you got?
2. No you shouldn't save it OnPlayerDisconnect, Because as you say, It's only the registration date.
Re: Registration date mysql -
Face9000 - 03.01.2017
Quote:
Originally Posted by oMa37
1. What errors you got?
2. No you shouldn't save it OnPlayerDisconnect, Because as you say, It's only the registration date.
|
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
Re: Registration date mysql -
oMa37 - 03.01.2017
Lines? ;-;
Re: Registration date mysql -
Yaa - 03.01.2017
Quote:
Originally Posted by oMa37
Lines? ;-;
|
rip
PHP код:
OnPlayerConnect(playerid)
{
/// blab blblabalbla
new date[3];
getdate(date[2], date[1], date[0]);
new month[15];
switch (date[1])
{
case 1: month = "January";
case 2: month = "Feburary";
case 3: month = "March";
case 4: month = "April";
case 5: month = "May";
case 6: month = "June";
case 7: month = "July";
case 8: month = "August";
case 9: month = "September";
case 10: month = "October";
case 11: month = "November";
case 12: month = "December";
}
new register_on[25];
format(register_on, sizeof(register_on), "%02d %s, %d", date[0], month, date[2]);
SQL::WriteString(handle, "p_regdate", register_on);
// BLA blablalbalbal
return 1;
}
Re: Registration date mysql -
Stuntff - 03.01.2017
Код:
new date[3];
getdate(date[2], date[1], date[0]);
new const months[12][20] =
{
"January",
"Febrary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
new register_on[25];
format(register_on, sizeof(register_on), "%02d %s, %d", date[0], months[date[1]-1], date[2]);
SQL::WriteString(handle, "p_regdate", register_on);
Re: Registration date mysql -
oMa37 - 03.01.2017
Quote:
Originally Posted by Yaa
rip
PHP код:
OnPlayerConnect(playerid)
{
/// blab blblabalbla
new date[3];
getdate(date[2], date[1], date[0]);
new month[15];
switch (date[1])
{
case 1: month = "January";
case 2: month = "Feburary";
case 3: month = "March";
case 4: month = "April";
case 5: month = "May";
case 6: month = "June";
case 7: month = "July";
case 8: month = "August";
case 9: month = "September";
case 10: month = "October";
case 11: month = "November";
case 12: month = "December";
}
new register_on[25];
format(register_on, sizeof(register_on), "%02d %s, %d", date[0], month, date[2]);
SQL::WriteString(handle, "p_regdate", register_on);
// BLA blablalbalbal
return 1;
}
|
Did you even change something smartass? All what you did that you moved the code into a callback (You didn't even public it), That guy didn't say anything about where that code is.
Re: Registration date mysql -
Face9000 - 03.01.2017
Is at the register dialog.
Re: Registration date mysql -
IceCube! - 03.01.2017
Which lines are these errors on? These essentially mean you have too few or too many arguments. Example:
Definition: GetPlayerMoney(playerid);
Incorrect Usage: GetPlayerMoney(playerid, Money);
Here you would have 2 arguments instead of just the one. If you point out the lines I'll point out the mistakes.
Re: Registration date mysql -
Vince - 03.01.2017
Don't store time or date as a formatted string in SQL. Time and date should only ever be formatted right before they're sent to an output (i.e. client message, dialog text, textdraw, ...). You want to store data in as versatile a manner as possible; that is a Unix timestamp or an ISO string (YYYY-MM-DD HH:MM:SS). I don't know if you're using SQLite or MySQL (I really dislike those "easy" SQL includes) but both have functions to convert time and date.