No timers are working
#1

Hey!

This morning I fixed a system so if you're a donator you could buy a parrot and then use /parrot to get it attached to your body. When I loaded the GM on my server no timer were working so I removed that system. When I uploaded the new GM they were not working either. Are there a solution for this?

Sorry if I wrote with incorrect grammar etc. I'm so damn tired, still!
Reply
#2

You mean
SetTimer
SetTimerEx ?
Reply
#3

To create a working timer:
At the top:
pawn Код:
forward YourTimer();
Set the Timer:
pawn Код:
SetTimer("YourTimer",time,repeating);
The effect of the timer:
pawn Код:
public YourTimer()
{
// do something here
return 1;
}
Reply
#4

@Biesman, Yes I'm using SetTimer and SetTimerEx.
@Cale, Exactly what I've done but they're not like being runned or they're failing while starting the timer.
Reply
#5

Care to show us your script?
Reply
#6

I've got this simple:
pawn Код:
forward AirBreakTimer();

public OnGameModeInit()
{
   SetTimer("AirBreakTimer", 1000, 1);
   return 1;
}

public AirBreakTimer()
{
    for(new i = 0; i < MAX_PLAYERSEX; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(!IsPlayerInAnyVehicle(i))
            {
                new Float:pVelocity[3], speedst[150];
                GetPlayerVelocity(i, pVelocity[0], pVelocity[1], pVelocity[2]);
                new Float:pSpeed = floatsqroot(floatpower(pVelocity[0], 2) + floatpower(pVelocity[1], 2) + floatpower(pVelocity[2], 2)) * 199;
                if(pSpeed >= 100)
                {
                    if(GetPlayerWeapon(i) != 46)
                    {
                        if(airbreak[i] >= 10)
                        {
                            format(speedst, sizeof(speedst), "[Alert:] %s (ID: %d) might be surfing with %0.0f KM/H", GetNameEx(i), i, pSpeed);
                            AdministratorMessage(COLOR_RED, speedst, 1);
                            airbreak[i] = -1;
                        }
                        airbreak[i]++;
                    }
                }
            }
        }
    }
    return 1;
}
I've got 19 timers starting under OnGameModeInit
Reply
#7

In the past I've also experienced problems with timers. But it was a BAD code mistake.

Here is the first problem I've had:
pawn Код:
new String[50];
format(String, 60, "bablablbal%s%i", blabla, blabl);
The code will not run at all, because you are trying to allocate more cells into the string.
The other problem was to return a 0 in one of my timer functions, that disabled all the bottom ( following ) timers.

Hope this helps, can't really tell your problem.
Reply
#8

Thanks for the help Lethal, but it didn't solve anything. I really can't find out the problem. It just didn't working this morning, but worked successfully yesterday. I've tried to use an old backup from my GM but that didn't solve it either. So it's not the script doing anything.
Reply
#9

pawn Код:
for(new i = 0; i < MAX_PLAYERSEX; i++)
Try to change this into:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#10

Put prints in all timers and check 'em all!

Also, 19 TIMERS? YOU INSANE?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)