LastLoggedIn [HELP +REP]
#1

I put this code to when player logged in
pawn Код:
Player[playerid][LastLoggedIn] = gettime();
pawn Код:
//when player disconnect
INI_WriteString(file, "pLastLoggedIn", Player[playerid][LastLoggedIn]);

But it not work
Reply
#2

You set "LastLoggedIn" to gettime which is an integer and executed INI_WriteString. It should've been INI_WriteInt instead.
Reply
#3

I'm not an expert with dini nor gettime, but anyway instead of INI_WriteString try INI_WriteInt because time format is an integer.

edit: too late nvm
Reply
#4

I changed i got problem player account didn't save when player disconnect

pawn Код:
//load account
INI_Int("LastSeen", Player[playerid][pLastSeen]);

//onplayerdisconnect
INI_WriteInt(file,  "LastSeen",  Player[playerid][pLastSeen]);
Код:
[16:44:11] [debug] Run time error 6: "Invalid instruction"
[16:44:11] [debug]  Unknown opcode 0x3e4c59c at address 0x00000030
[16:44:11] [debug] AMX backtrace:
[16:44:11] [debug] #0 00000030 in public SSCANF_OnPlayerDisconnect () from TDM_RP.amx
[16:44:11] [debug] #1 native CallLocalFunction () from samp-server.exe
[16:44:11] [debug] #2 00002028 in public Streamer_OnPlayerDisconnect (4, 1) from TDM_RP.amx
[16:44:11] [debug] #3 000017bc in public OnPlayerDisconnect (4, 1) from TDM_RP.amx
[16:44:11] [part] Test has left the server (4:1)
Reply
#5

hmmm try use this :
//--------------------------------------------------------------------------------
stock SaveStats (playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "Player's Data");
INI_WriteString(File, "LastActive", TimeAndDate());
INI_WriteString(File, "AltName", PlayerInfo[playerid][AltName]);
INI_WriteString(File, "Registered_On", PlayerInfo[playerid][RegOn]);
INI_WriteHex(File, "Color", GetPlayerColor(playerid));
INI_WriteInt(File, "Hours", PlayerInfo[playerid][Hours]);
INI_WriteInt(File, "Minutes", PlayerInfo[playerid][Minutes]);
INI_Close(File);
return 1;
}
//-----------------------------------------------------------------------------------

hope this help
dont forget to give me +rep if this helped
Reply
#6

I want my own script -.-
Reply
#7

ok here

//put under onplayerdisconnect
INI_WriteInt(file, "pLastLoggedIn", TimeAndDate());
stock TimeAndDate ()
{
new year, month, day, hour, minute, sec, last[50];
getdate(year, month, day);
gettime(hour, minute, sec);
format(last, sizeof(last), "%d:%d:%d | %d/%d/%d", hour, minute, sec, day, month, year);
return last;
}
//------------------------------------------------------------
hope this help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)