SA-MP Forums Archive
[UNSOLVED] TextDraw Countdown - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [UNSOLVED] TextDraw Countdown (/showthread.php?tid=156943)



[UNSOLVED] TextDraw Countdown - Ironboy500 - 24.06.2010

Hello! I need help with count down showing in textdraw.
I got following.

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_HOODIES)
	{
	  new string[256], playername[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "%s is stealing money. It takes to take 10 seconds.", playername);
		TextDrawSetString(text3, string);
		TextDrawHideForAll(text4);
		TextDrawShowForAll(text3);
		SetTimer("Destroy3", 2000, false);
		man[playerid] = 1;
		plant = SetTimer("Planted", 10000, false);
	}
	return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_HOODIES)
	{
	  new string[256], playername[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, playername, sizeof(playername));
	  format(string, sizeof(string), "%s has quit stealing money.", playername);
	  KillTimer(plant);
		TextDrawSetString(text4, string);
		TextDrawHideForAll(text3);
		TextDrawShowForAll(text4);
		SetTimer("Destroy4", 2000, false);
		man[playerid] = 0;
	}
	return 1;
}
forward Planted();
public Planted()
{
  for(new i=0; i<MAX_PLAYERS; i++)
	{
	  timedeliver = 30;
 		DisablePlayerCheckpoint (i);
 		plant = SetTimer("UpdateTime", 1000, true);
	}
}
forward UpdateTime();
public UpdateTime()
{
	timedeliver--;
	new string[256];
	format(string, sizeof(string), "%i seconds until money is delivered.", timedeliver);
	TextDrawSetString(text19, string);
	TextDrawShowForAll(text19);
	if(timedeliver == 0)
	{
	  KillTimer(plant);
	  format(string, sizeof(string), "Money was succesfully delivered.", timedeliver);
		TextDrawSetString(text19, string);
		TextDrawShowForAll(text19);
		SetTimer("AttackWin", 2000, false);
	
	}
	

}
After played stayed in CP for 10 seconds timer don't go '30 seconds till money is delivered.', '29 seconds till money is delivered.', '28 seconds till money is delivered.'. It goes '0 seconds till money is delivered.', ''
-100 seconds till money is delivered.', '-2000 seconds till money is delivered.' and it is not stopping. Anyone can help to make it like '30 seconds till money is delivered.', '29 seconds till money is delivered.', '28 seconds till money is delivered.' till 0.
Thanks.


Re: [UNSOLVED] TextDraw Countdown - Ironboy500 - 24.06.2010

Lol no help


Re: [UNSOLVED] TextDraw Countdown - ReVo_ - 24.06.2010

you put plant in top of you script?


Re: [UNSOLVED] TextDraw Countdown - Ironboy500 - 24.06.2010

plant variable? Yea.

Код:
new plant;
new plant2;



Re: [UNSOLVED] TextDraw Countdown - ReVo_ - 24.06.2010

Ok...
In top of you script

pawn Код:
new PlantTimer;
new Second=30;
...and...
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(GetPlayerTeam(playerid) == TEAM_HOODIES)
    {
      new string[256], playername[MAX_PLAYER_NAME];
      GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "%s is stealing money. It takes to take 10 seconds.", playername);
        TextDrawSetString(text3, string);
        TextDrawHideForAll(text4);
        TextDrawShowForAll(text3);
        SetTimer("Destroy3", 2000, false);
        man[playerid] = 1;
        PlantTimer = SetTimer("Planted", 10000, false);
    }
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    if(GetPlayerTeam(playerid) == TEAM_HOODIES)
    {
      new string[256], playername[MAX_PLAYER_NAME];
      GetPlayerName(playerid, playername, sizeof(playername));
      format(string, sizeof(string), "%s has quit stealing money.", playername);
      KillTimer(PlantTimer);
        TextDrawSetString(text4, string);
        TextDrawHideForAll(text3);
        TextDrawShowForAll(text4);
        SetTimer("Destroy4", 2000, false);
        man[playerid] = 0;
        Second=30;
    }
    return 1;
}

forward Planted();
public Planted()
{
  Second--;
  if(Second < 1)
  {
    KillTimer(PlantTimer);
      format(string, sizeof(string), "Money was succesfully delivered.", timedeliver);
        TextDrawSetString(text19, string);
        TextDrawShowForAll(text19);
        SetTimer("AttackWin", 2000, false);
    }
    else
    {
        new string[256];
        format(string, sizeof(string), "%i seconds until money is delivered.", timedeliver);
        TextDrawSetString(text19, string);
        TextDrawShowForAll(text19);
    }
}
i not tested..


Re: [UNSOLVED] TextDraw Countdown - Ironboy500 - 24.06.2010

It is staying freezed on 30 seconds, let me see something I think I got it now