switch(dialogid) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SpawnPlayer(playerid); new pName[MAX_PLAYER_NAME]; new string[128]; GetPlayerName(playerid, pName, sizeof(pName)); format(string, sizeof(string), "You register account with the name: %s, password: %s", pName); } }
Make use of these following functions:
format SendClientMessage getdate GetPlayerName In the login function, fetch the last online date and format the message and send it. Save the date. In the register function, fetch the date, the account name and password. Do the same as the login one, format it and send it. Save the date. That's it. |
new name[25], string[100], day, month, year; GetPlayerName(playerid, name, sizeof(name)); getdate(year, month, day); format(string, 100,"Your registered account: <Name:%s><Password:%s>[Day:%d, Month:%d, Year:%d]", name,inputtext, day, month, year); SendClientMessage(playerid, COLOR_YOUWANT, string);
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SpawnPlayer(playerid);
new name[25], string[100], day, month, year;
GetPlayerName(playerid, name, sizeof(name));
getdate(year, month, day);
format(string, 100,"Your registered account: <Name:%s><Password:%s>[Day:%d, Month:%d, Year:%d]", name,inputtext, day, month, year);
SendClientMessage(playerid, COLOR_YOUWANT, string);
}
}
switch(dialogid) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SpawnPlayer(playerid); new pName[MAX_PLAYER_NAME]; new string[128]; GetPlayerName(playerid, pName, sizeof(pName)); format(string, sizeof(string), "You register account with the name: %s, password: %s", pName, inputtext); } }
new Day, Month, Year, Hour, Minute, Second; getdate(Year, Month, Day); gettime(Hour, Minute, Second);
format(str, sizeof(str), "Welcome back, %s. Your last login was on %d/%d/%d at %d:%d:%d.", GetPName(playerid), PlayerInfo[playerid][pLLYear], PlayerInfo[playerid][pLLMonth], PlayerInfo[playerid][pLLDay], PlayerInfo[playerid][pLLHour], PlayerInfo[playerid][pLLMin], PlayerInfo[playerid][pLLSec]);
BulletRaja Your thing might work but how do i make when the player log again it says your last time in the server? I need to safe the date and the time? If i need tell me how?
|
new Hour, Minute, Second, Year, Month, Day; gettime(Hour, Minute, Second); getdate(Year, Month, Day); //The following, I did with Y_Ini. It might differ if you don't use Y_Ini. new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"SomeTagHere"); INI_WriteInt(File,"Sec",Second); INI_WriteInt(File,"Min",Minute); INI_WriteInt(File,"Hour",Hour); INI_WriteInt(File,"Day",Day); INI_WriteInt(File,"Month",Month); INI_WriteInt(File,"Year",Year); ...
if(udb_hash(inputtext) == pPass) //You need to do udb_hash for inputtext since your pPass is a result of your password going through udb_hash as well.