04.01.2015, 11:55
Hello, I have a problem with the timer, and so:
and so on ...
"CheckMySQL" gamemode code:
and
"AutomaticallyRespawnVehicles" this..
Please help me, by that other things do not work.
Thanks.
Код:
[21:33] (TimerFix) WARNING: The function "CheckMySQL" took 24ms to execute! This will affect other timers. [21:33] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:33] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:33] (TimerFix) WARNING: The function "AutomaticallyRespawnVehicles" took 1355ms to execute! This will affect other timers. [21:33] (TimerFix) WARNING: The function "CheckMySQL" took 22ms to execute! This will affect other timers. [21:33] (TimerFix) WARNING: The function "CheckMySQL" took 24ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 24ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "AutomaticallyRespawnVehicles" took 1352ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 23ms to execute! This will affect other timers. [21:34] (TimerFix) WARNING: The function "CheckMySQL" took 22ms to execute! This will affect other timers. [21:35] (TimerFix) WARNING: The function "CheckMySQL" took 24ms to execute! This will affect other timers. [21:35] (TimerFix) WARNING: The function "CheckMySQL" took 24ms to execute! This will affect other timers.
"CheckMySQL" gamemode code:
Код:
forward CheckMySQL();
Код:
SetTimer("CheckMySQL", 5000, true);
Код:
public CheckMySQL()
{
if(mysql_ping() == 0)
mysql_reconnect();
return 1;
}
Код:
forward AutomaticallyRespawnVehicles();
Код:
SetTimer("AutomaticallyRespawnVehicles", 1000*60*1, true);
Код:
public AutomaticallyRespawnVehicles()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
if(!IsVehicleInUse(i, 5) && !IsTrailerAttached(i, 3))
{
if(IsTrailerAttachedToVehicle(i))
{
new trailerid = GetVehicleTrailer(i);
DetachTrailerFromVehicle(i);
SetVehicleToRespawn(trailerid);
}
if(vInfo[i][Owner] != -1 && vInfo[i][Fraction] == 0)
{
UnloadPlayerVehicles(vInfo[i][Owner]);
LoadPlayerVehicles(vInfo[i][Owner]);
}
else
{
SetVehicleToRespawn(i);
}
}
}
}
Thanks.

