Gang Points - 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: Gang Points (
/showthread.php?tid=413298)
Gang Points -
mrtms - 04.02.2013
For whatever reason the timer is set at 10 minutes (600 seconds) and it only counts down to 596. Here's the code:
PHP код:
forward PointCaptureTimer(point, time);
public PointCaptureTimer(point, time)
{
new string[124];
if(PointCapper[point] != INVALID_PLAYER_ID)
{
PointTimeLeft[point]--;
printf("Time: %d", 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);
}
return 1;
}
I'm not to sure what's making this happen. Any help would be greatly apprecaited!
Re: Gang Points -
mrtms - 04.02.2013
Never mind, fixed it! Thanks anyways!
EDIT: Never mind I DID NOT fix it. Help me out please!
Re: Gang Points -
mrtms - 04.02.2013
Ok I didn't fix it evidently. Whenever I move/jump it gives me that error in the CMD. This is the function that counts down from 10-0.
PHP код:
forward PointProgressTimer(point, time);
public PointProgressTimer(point, time)
{
if(PointCapper[point] != INVALID_PLAYER_ID && time > 0)
{
new Float: cCoords[3];
GetPlayerPos(PointCapper[point], cCoords[0], cCoords[1], cCoords[2]); //Get the players coordinates
//If the player moves from the capture point at all, then he/she will lose the capture progress
PointTimeLeft[point]--;
SendClientMessageEx(PointCapper[point], COLOR_WHITE, "Time: %d", PointTimeLeft[point]);
if(PointTimeLeft[point] == 0)
{
new string[84];
PointTimeToClaim[point] = gettime();
PointTimeLeft[point] = 600;
KillTimer(pointTimer);
captureTimer = SetTimerEx("PointCaptureTimer", 1000, 0, "dd", GetPointRange(PointCapper[point]), PointTimeLeft[point]);
format(string, sizeof(string), "%s is attempting to take over of the %s!", Families[famEnum(PointCapper[point])][fName], Point[GetPointRange(PointCapper[point])][poName]);
SendClientMessageToAll(COLOR_RED, string);
}
}
if(time > 0)
{
new Float: cCoords[3];
GetPlayerPos(PointCapper[point], cCoords[0], cCoords[1], cCoords[2]); //Get the players coordinates
//If the player moves from the capture point at all, then he/she will lose the capture progress
if(PointX[point] != cCoords[0] || PointY[point] != cCoords[1] || PointZ[point] != cCoords[2] || Injured[PointCapper[point]] > 0 || !IsLoggedIn[PointCapper[point]] || playerTabbed[PointCapper[point]] == true)
{
KillTimer(pointTimer);
//Alert the player that he moved and since doing so, he failed to capture the point
SendClientMessage(PointCapper[point], COLOR_GRAD3, "You have failed to capture this point since you moved or are injured.");
PointX[point] = 0;
PointY[point] = 0;
PointZ[point] = 0;
PointCapper[point] = -1;
PointFam[point] = 0;
PointID[point] = -1;
PointTimeToClaim[point] = 0;
PointTimeLeft[point] = 0;
}
else
{
pointTimer = SetTimerEx("PointProgressTimer", 1000, 0, "dd", GetPointRange(PointCapper[point]), time - 1);
}
}
return 1;
}
Re: Gang Points -
mrtms - 04.02.2013
Anyone got any ideas? Any help would be greatly appreciated!