how to make last connect?
#1

i mean how to make last connect and send message to player ,, ~

message like this

"Last Connect Days/Month/Years" // exlampe : "Last Connect 28/11/2013"

and saving ~
Reply
#2

Make a player variable to hold last connect, ex: pTime
pawn Код:
public OnPlayerDisconnect(playerid)
{
    PlayerInfo[playerid][pTime] = gettime();
    // then save it
    return 1;
}
Then load your pTime variable OnPlayerConnect, and convert it to mm/dd/yy
Reply
#3

how to load~

like this?
Код:
format(string, sizeof(string), " Last Connect %d" PlayerInfo[playerid][pTime]);
SendClientMessage(playerid, COLOR_BLUE, string);
Reply
#4

Quote:
Originally Posted by kloning1
Посмотреть сообщение
nah terus kalau buat loadny gmn :v

lngsng kah??
Код:
format(string, sizeof(string), " Last Connect %d" PlayerInfo[playerid][pTime]);
SendClientMessage(playerid, COLOR_BLUE, string);
Please speak English in a Global Forum
You have to convert your variable to a regular time, you need this function to do so:
pawn Код:
stock ConvertMsToTime(ms)
{
    new seconds = ms/1000;
    new string[32];
    format(string, sizeof(string), "%02d:%02d:%02d - %02d:%02d:%02d",
        seconds/31536000, (seconds%31536000)/2592000, (seconds%2592000)/86400,
        (seconds%86400)/3600, (seconds%3600)/60, seconds%60);
    return string;
}

public OnPlayerConnect(playerid)
{
    format(string, sizeof(string), " Last Connect %s" ConvertMsToTime(PlayerInfo[playerid][pTime]));
    SendClientMessage(playerid, COLOR_BLUE, string);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)