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=413522)
Timer -
mrtms - 05.02.2013
I need a looping item that will check every second for 10 minutes straight. I need it done every second, also will this loop do any damage to my server, resource wise? This will be for points and I need some kind of countdown system and various checks for it to work. I have no idea where to start for this part. Any help will be appreciated!
Re: Timer -
zde5 - 05.02.2013
post it in Script Request Thread (
https://sampforum.blast.hk/showthread.php?tid=187229)
Re: Timer -
mrtms - 05.02.2013
I have my own timer system but it seems that it's breaking when someone moves around and jumps. I have no idea why, here's what the Command Prompt displays:
Re: Timer -
zde5 - 05.02.2013
first two [debug] lines are saying that you are accessing array with negative element (ex. a[-1])
Re: Timer -
mrtms - 05.02.2013
PHP код:
forward PointCaptureTimer(point, time);
public PointCaptureTimer(point, time)
{
new string[124];
printf("Time1: %d", PointTimeLeft[point]);
if(PointFam[point] != 0)
{
printf("Time2: %d", PointTimeLeft[point]);
PointTimeLeft[point]--;
if(PointTimeLeft[point] == 0)
{
Point[point][poFid] = PointFam[point];
format(Point[point][poCapper], MAX_PLAYER_NAME, pNameEx(PointCapper[point]));
Point[point][poDate] = gettime();
format(string, sizeof(string), "%s has successfully captured \"%s\".", Families[famEnum(Point[point][poCapper])][fName], Point[GetPointRange(Point[point][poCapper])][poName]);
ProxDetector(70.0, Point[point][poCapper], string, COLOR_RED);
PointX[point] = 0;
PointY[point] = 0;
PointZ[point] = 0;
PointCapper[point] = -1;
PointFam[point] = 0;
PointID[point] = -1;
PointTimeToClaim[point] = 0;
PointTimeLeft[point] = 0;
KillTimer(captureTimer);
}
}
if(time > 0)
{
captureTimer = SetTimerEx("PointCaptureTimer", 1000, 0, "dd", GetPointRange(PointCapper[point]), time - 1);
printf("Timer: %d", time);
}
return 1;
}
The timer starts at 600 seconds and counts down from there. It doesn't display that error until I begin to move around and what not. I have no idea why it does that.
Re: Timer -
mrtms - 05.02.2013
Wow never mind I noticed the problem...