27.05.2009, 11:49
Could remove the timers and use GetTickCount.
pawn Код:
// Global Variable
new CommandTimeStamp[ MAX_PLAYERS ];
// OnPlayerConnect
CommandTimeStamp[ MAX_PLAYERS ] = 0;
// OnPlayerCommandText
if ( !strcmp( "/mycommand", cmdtext, true ) )
{
if ( ( GetTickCount() - CommandTimeStamp[ playerid ] ) < 10000 ) // If difference in time is less than 10000 ms (10 seconds)
return SendClientMessage( playerid, "You must wait 10 seconds before using this command again." );
else
{
CommandTimeStamp[ playerid ] = GetTickCount( );
// Your code!
}
}