SA-MP Forums Archive
Time Log in - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Time Log in (/showthread.php?tid=374120)



Time Log in - kbalor - 01.09.2012

My time login loops to all players. If the first player has 5 hours time log in, then if someone connect his time login is also 5 hours.

Код:
new str[512],  h, m, s;
TotalGameTime(player1, h, m, s);   
format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);



Re: Time Log in - Roko_foko - 01.09.2012

Show us TotalGAmeTime function and function that you use to show player the "str"


Re: Time Log in - kbalor - 02.09.2012

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
Show us TotalGAmeTime function and function that you use to show player the "str"
Here it is! Sorry it was kinda late
Код:
TotalGameTime(playerid, &h=0, &m=0, &s=0)
{
    AccInfo[playerid][TotalTime] = ( (gettime() - AccInfo[playerid][ConnectTime]) + (AccInfo[playerid][hours]*60*60) + (AccInfo[playerid][mins]*60) + (AccInfo[playerid][secs]) );
    h = floatround(AccInfo[playerid][TotalTime] / 3600, floatround_floor);
    m = floatround(AccInfo[playerid][TotalTime] / 60,   floatround_floor) % 60;
    s = floatround(AccInfo[playerid][TotalTime] % 60,   floatround_floor);
    return AccInfo[playerid][TotalTime];
}
Код:
new str[512],  h, m, s;
TotalGameTime(player1, h, m, s);   
format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
Код:
dcmd_stats(playerid,params[])
{
    new str[512], h, m, s;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
    if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, white, "{FF0000}>> Player not Connected");
    TotalGameTime(player1, h, m, s);
    format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
    ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
    return 1;
}