Timer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer (
/showthread.php?tid=554594)
Timer -
Sowi - 04.01.2015
Hello, I have a problem with the timer, and so:
Код:
[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.
and so on ...
"CheckMySQL" gamemode code:
Код:
forward CheckMySQL();
Код:
SetTimer("CheckMySQL", 5000, true);
and
Код:
public CheckMySQL()
{
if(mysql_ping() == 0)
mysql_reconnect();
return 1;
}
"AutomaticallyRespawnVehicles" this..
Код:
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);
}
}
}
}
Please help me, by that other things do not work.
Thanks.