16.11.2014, 00:19
(
Последний раз редактировалось MasonSFW; 16.11.2014 в 08:39.
)
Remove please
if(strcmp(cmd, "/lastlogin", true) == 0) { if(IsPlayerConnected(playerid)) { new string2[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /lastlogin [full name(case sensative)]"); return 1; } if(PlayerInfo[playerid][pAdmin] >= 5) { format(string, sizeof(string), "%s.ini",tmp); if(dini_Exists(string)) { string2 = dini_Get(string, "LastLogin"); format(string, sizeof(string), "%s's last login: %s", tmp,string2); SendClientMessage(playerid,COLOR_WHITE, string); return 1; } else { SendClientMessage(playerid, COLOR_GRAD2, "That player does not exist!"); } } } return 1; } |
CMD:lastlogged(playerid, params[])
{
new string[75];
new tmp = LastLogged[playerid] - gettime();
tmp = tmp/1000;
format(string, sizeof(string), "Last online: %d seconds ago", tmp);
SendClientMessage(playerid, -1, string);
return 1;
}
stock ConvertTimeToString(weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0)
{
while(seconds >= 60) minutes++, seconds -= 60;
while(minutes >= 60) hours++, minutes -= 60;
while(hours >= 24) days++, hours -= 24;
while(days >= 7) weeks++, days -= 7;
new string[70], fstr[20];
if(weeks) { format(fstr, sizeof(fstr), (weeks == 1) ? ("%d week") : ("%d weeks"), weeks); if(days || hours || minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, 0); }
if(days) { format(fstr, sizeof(fstr), (days == 1) ? ("%d day") : ("%d days"), days); if(hours || minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(hours) { format(fstr, sizeof(fstr), (hours == 1) ? ("%d hour") : ("%d hours"), hours); if(minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(minutes) { format(fstr, sizeof(fstr), (minutes == 1) ? ("%d minute") : ("%d minutes"), minutes); if(seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(seconds) { format(fstr, sizeof(fstr), (seconds == 1) ? ("%d second") : ("%d seconds"), seconds), strins(string, fstr, strlen(string)); }
return string;
}
new string[128];
format(string, sizeof(string), "You last logged in: %s ago", ConvertTimeToString(.seconds = (gettime() - LastLoggedIn[playerid])));
SendClientMessage(playerid, -1, string);
LastLoggedIn[playerid] = gettime();