How much time played on Server
#1

1. How can I count, how much time player played on server?

2. If I have this timer started:
SetTimer(timer,1200000,false); (20 minutes)
is it possible to see how much time left after few minutes?
Reply
#2

When the player joins, gettickcount.. when they check, gettickcount again... the difference is thetime he has been there in ms.

EDIT: Alternatively use Gettime which works in seconds and sounds more reliable..

Example:
pawn Код:
#include <a_samp>

new Time[MAX_PLAYERS], string[128];

public OnPlayerConnect(playerid)
{
    Time[playerid] = gettime();
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Time", cmdtext, true, 10) == 0)
    {
        format(string, sizeof(string), "You have been here %d seconds!", gettime() - Time[playerid]);
        SendClientMessage(playerid, 0xFF00FFFF, string);
        return 1;
    }
    return 0;
}
EDIT: No timers, no mess

EDIT: Sorry made a fail somewhere, lemme checkit
Reply
#3

Oh thanks..
Reply
#4

OK, it only works for me when I'm not running debugger.. There must be a reason for this other than the fact they share /time (I checked by changing the command name)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)