12.10.2010, 11:22
That's quite a bad way of putting restrictions on players, timers should never be used for such things. Just put the time of their last action you want to block in a variable, then when they try to do it again check if X seconds passed since that timestamp.
I would love to have some form of comparison between the CPU usage of the two different methods, but I can't think of any way to benchmark them properly.
pawn Code:
new repairtime[MAX_PLAYERS];
OnPlayerCommandText // or whatever function you're using it in
{
// ... they try to do it:
if(repairtime[playerid] < gettime()) // If they've waited long enough
{
// Do the repair
repairtime[playerid] = gettime()+X // X = Amount of seconds you want to block them
}
}