gettickcount.
#8

I suggest you using gettime instead of GetTickCount, GetTickCount returns in milliseconds and gettime returns in seconds, also check the disadvantages about GetTickCount, you also need a new variable, so the message won't spam. example code below.

pawn Код:
#include <a_samp>

#if defined MAX_PLAYERS
    #undef MAX_PLAYERS
    #define MAX_PLAYERS (255)
#endif

static stock
    tick[ MAX_PLAYERS char ], bool:tickSpam[ MAX_PLAYERS char];

public OnPlayerUpdate(playerid)
{
    if( (gettime( ) - tick{playerid} > 5) && ( !tickSpam{ playerid } ) )
    {
        tickSpam{ playerid } = true;
        SendClientMessage( playerid, -1, "Command Status: UnAvailable" );
    }
    else if( (gettime( ) - tick{ playerid } < 5) && ( tickSpam{ playerid } ) )
    {
        tickSpam{ playerid } = false;
        SendClientMessage( playerid, -1, "Command Status: Available" );
    }
    return true;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_ACTION)
    {
        // rest of the code.
        tick{ playerid } = gettime( );
    }
    return true;
}
Reply


Messages In This Thread
gettickcount. - by newbienoob - 13.02.2014, 16:07
Re: gettickcount - by Konstantinos - 13.02.2014, 16:09
Re: gettickcount. - by newbienoob - 13.02.2014, 16:19
Re: gettickcount. - by Yashas - 13.02.2014, 16:23
Re: gettickcount. - by newbienoob - 13.02.2014, 16:33
Re: gettickcount. - by Yashas - 13.02.2014, 16:37
Re: gettickcount. - by newbienoob - 13.02.2014, 16:39
Re: gettickcount. - by Patrick - 13.02.2014, 16:44
Re: gettickcount. - by Yashas - 13.02.2014, 16:44
Re: gettickcount. - by newbienoob - 13.02.2014, 16:58

Forum Jump:


Users browsing this thread: 1 Guest(s)