/fix command with 60 seconds
#5

There's no need to even use a timer for this! Why not just use GetTickCount();?

For example:

pawn Код:
new intLastTick[MAX_PLAYERS] = 0;
pawn Код:
if (strcmp("/fix",cmdtext,true) == 0)
{
    if((GetTickCount() - intLastTick[playerid]) > 60000)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehicleHealth(GetPlayerVehicleID(playerid),100.000);
            SendClientMessage(playerid,COLOR_ADMINS,"You have fixed the vehicle!");
            intLastTick[playerid] = GetTickCount();
        }
    }
    return 1;
}
No timers and the code is much cleaner!

P.S: Fix your indentation!
Reply


Messages In This Thread
/fix command with 60 seconds - by bijoyekuza - 18.03.2011, 15:10
Re: /fix command with 60 seconds - by WackoX - 18.03.2011, 15:21
Re: /fix command with 60 seconds - by bijoyekuza - 18.03.2011, 15:33
Re: /fix command with 60 seconds - by WackoX - 18.03.2011, 20:53
Re: /fix command with 60 seconds - by JaTochNietDan - 18.03.2011, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)