A little question about timer
#1

In my GM are few timers and one of them isn't working properly, I think. When I go on a pickup, a countingdown is starting and also a CheckPoint appears. If you leave the checkpoint, the countingdown will be stopped. It is "Capture the territory". So, when I enter pickup on the screen appears "30 (GameText which is supposed to split in 3 sec.)" (countingdown from 30 sec to 0, to captutre), but whole time, while capturing, system shows me "30", when it's supposed to show 30, (after 1 sec.) 29 and etc... So where's a problem?
Reply
#2

The problem is a missing "+" on line 5379.

If that turns out not to be the problem then my psychic powers are clearly not up to this task and instead you will have to actually SHOW US THE CODE!
Reply
#3

When timer starts:
Код:
                        SendClientMessage(playerid, COLOR_GREEN, "You are attacking The Ship! Attacking duration - 30 seconds! Good luck!");
			SendClientMessage(playerid, COLOR_ORANGE, "Just don't leave this checkpoint, or countingdown will be stopped!");
			new strn[256];
			format(strn, sizeof(strn), "%s is attacking The Ship!", PlayerName(playerid));
			SendClientMessageToAll(COLOR_GREEN, strn);
			GameTextForPlayer(playerid, "~g~30", 3000, 6);
			TS_Timer = SetTimerEx("TS_CountDown", 1000, true, "i", playerid);
			SetPlayerCheckpoint(playerid, -2315.0615,1544.8688,18.7734, 3);
			printf("[%d.%d.%d] %s is attacking The Ship",ye,mo,da, PlayerName(playerid));
And a callback called from timer:

Код:
public TS_CountDown(playerid)
{
	getdate(ye,mo,da);
	if(IsPlayerInCheckpoint(playerid))
	{
		TS_CD_Value[playerid]--;
		new count[256];
		if(playerDB[playerid][TS_Owners] == true)
		{
		    SendClientMessage(playerid, COLOR_YELLOW, "Your team member was faster than you :) !!");
		    KillTimer(TS_Timer);
		    GameTextForPlayer(playerid, "STOP", 3000, 6);
		    TS_CD_Value[playerid] = 30;
            DisablePlayerCheckpoint(playerid);
		}
		else if(TS_CD_Value[playerid] == 0)
		{
		    KillTimer(TS_Timer);
		    TS_CD_Value[playerid] = 30;
            DisablePlayerCheckpoint(playerid);
		    GameTextForPlayer(playerid, "~g~PERIMTA!", 3000, 6);
   			for(new a = 0, k = GetMaxPlayers(); a <= k; a++)
		    {
		        if(playerDB[a][TS_Owners] == true) playerDB[a][TS_Owners] = false;
		    }
		    if(GetPlayerTeam(playerid) == 1)
		    {
		        GangZoneShowForAll(TheShipZone, COLOR_PRABADOS);
		 		new stringas[256];
			    format(stringas, sizeof(stringas), "%s [LOS ZETAS] took over The Ship!", PlayerName(playerid));
			    SendClientMessageToAll(COLOR_PRABADOS, stringas);
			    printf("[%d.%d.%d] %s successfully attacked The Ship for Los Zetas",ye,mo,da, PlayerName(playerid));
			    dini_Set("GangZones.ini", "THE SHIP", "ZETAS");
			    for(new i = 0,a = GetMaxPlayers(); i <= a; i++)
			    {
			        if(GetPlayerTeam(i) == 1)
			        {
			            playerDB[i][TS_Owners] = true;
			        }
			    }
		    }
			else if(GetPlayerTeam(playerid) == 2)
			{
			    GangZoneShowForAll(TheShipZone, COLOR_BRODAROS);
			    new stringas[256];
			    format(stringas, sizeof(stringas), "%s [BIKERS] took over The Ship!", PlayerName(playerid));
			    SendClientMessageToAll(COLOR_BRODAROS, stringas);
			    printf("[%d.%d.%d] %s successfully attacked The Ship for Bikers",ye,mo,da, PlayerName(playerid));
			    dini_Set("GangZones.ini", "THE SHIP", "BIKERS");
			    for(new i = 0,a = GetMaxPlayers(); i <= a; i++)
			    {
			        if(GetPlayerTeam(i) == 2)
			        {
			            playerDB[i][TS_Owners] = true;
			        }
			    }
			}
			else if(GetPlayerTeam(playerid) == 3)
			{
				GangZoneShowForAll(TheShipZone, COLOR_GRADAROS);
			    new stringas[256];
			    format(stringas, sizeof(stringas), "%s [COSA NOSTRA] took over The Ship!", PlayerName(playerid));
			    SendClientMessageToAll(COLOR_GRADAROS, stringas);
			    printf("[%d.%d.%d] %s successfully attacked The Ship for Cosa Nostra",ye,mo,da, PlayerName(playerid));
			    dini_Set("GangZones.ini", "THE SHIP", "COSA");
			    for(new i = 0,a = GetMaxPlayers(); i <= a; i++)
			    {
			        if(GetPlayerTeam(i) == 3)
			        {
			            playerDB[i][TS_Owners] = true;
			        }
			    }
			}
			else if(GetPlayerTeam(playerid) == 4)
			{
			    GangZoneShowForAll(TheShipZone, COLOR_CREEKERS);
			    new stringas[256];
			    format(stringas, sizeof(stringas), "%s [YAKUZA] took over The Ship!", PlayerName(playerid));
			    SendClientMessageToAll(COLOR_CREEKERS, stringas);
			    printf("[%d.%d.%d] %s successfully attacked The Ship for Yakuza",ye,mo,da, PlayerName(playerid));
			    dini_Set("GangZones.ini", "THE SHIP", "YAKUZA");
			    for(new i = 0,a = GetMaxPlayers(); i <= a; i++)
			    {
			        if(GetPlayerTeam(i) == 4)
			        {
			            playerDB[i][TS_Owners] = true;
			        }
			    }
			}
			else if(GetPlayerTeam(playerid) == 5)
			{
			    GangZoneShowForAll(TheShipZone, COLOR_BAYSIDERS);
			    new stringas[256];
			    format(stringas, sizeof(stringas), "%s [BAYSIDERS] took over The Ship!", PlayerName(playerid));
			    SendClientMessageToAll(COLOR_BAYSIDERS, stringas);
			    printf("[%d.%d.%d] %s successfully attacked The Ship for Baysiders",ye,mo,da, PlayerName(playerid));
			    dini_Set("GangZones.ini", "THE SHIP", "BAYSIDERS");
			    for(new i = 0,a = GetMaxPlayers(); i <= a; i++)
			    {
			        if(GetPlayerTeam(i) == 5)
			        {
			            playerDB[i][TS_Owners] = true;
			        }
			    }
			}
		}
		else
		{
		    format(count, sizeof(count), "~g~%d", TGS_CD_Value);
		    GameTextForPlayer(playerid, count, 3000, 6);
		}
	}
	else
	{
	    printf("[%d.%d.%d] %s stopped attacking The Ship at second %d",ye,mo,da, PlayerName(playerid), TS_CD_Value);
	    GameTextForPlayer(playerid, "~r~STOP", 3000, 6);
	    SendClientMessage(playerid, COLOR_RED, "You are not in CheckPoint, so countingdown has been stopped!");
	    KillTimer(TS_Timer);
	    TS_CD_Value[playerid] = 30;
	    DisablePlayerCheckpoint(playerid);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)