SA-MP Forums Archive
Timer/Countdown/Million - 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: Timer/Countdown/Million (/showthread.php?tid=68726)



Timer/Countdown/Million - KyleLyndonSmith - 13.03.2009

Hello i have a countdown thing but when its finished i wanted it to say "You Have Managed To Gain Access To The Vault Door''
But it says it but says it LOTS of times and never stops any ideas why? Thanks


Quote:

public robbingcasinovaultcountdown()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(robbingcasinovault[i] >= 2)
{
robbingcasinovault[i] --;
new string[256];
new robtimer;
robtimer = (robbingcasinovault[i]);
format(string, sizeof(string), "~y~OPENING DOOR~n~~b~STAY IN THE CHECKPOINT~n~~w~OPEN IN~r~ %d~w~ SECONDS",robtimer);
GameTextForPlayer(i, string, 3000,3);
}
if(robbingcasinovault[i] == 1)
{
new string[256];
format(string, sizeof(string), "You Have Managed To Gain Access To The Vault Door");
SendClientMessage(i,COLOR_YELLOW2, string);
}

}
}
}




Re: Timer/Countdown/Million - mascii - 13.03.2009

https://sampwiki.blast.hk/wiki/SetTimer

You could check that out, notice that it has repeat, you put either true or false in it.

I'm suggesting this because I had a similar problem to you, then I changed it to false and it worked

Hope this helps


Re: Timer/Countdown/Million - Kinetic - 13.03.2009

pawn Code:
// With all the other new definitions.
new Robbed[MAX_PLAYERS];

// In OnPlayerConnect.
Robbed[playerid] = 0;

// Replace your old one with this.
public robbingcasinovaultcountdown()
{
  for(new i=0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      if(robbingcasinovault >= 2)
      {
      robbingcasinovault --;
        new string[256];
        new robtimer;
        robtimer = (robbingcasinovault);
        format(string, sizeof(string), "~y~OPENING DOOR~n~~b~STAY IN THE CHECKPOINT~n~~w~OPEN IN~r~ %d~w~ SECONDS",robtimer);
        GameTextForPlayer(i, string, 3000,3);
     }
     if(robbingcasinovault == 1)
      {
        if(Robbed[playerid] == 0)
        {
          new string[256];
          format(string, sizeof(string), "You Have Managed To Gain Access To The Vault Door");
          SendClientMessage(i,COLOR_YELLOW2, string);
          Robbed[i] = 1;
        }
     }

   }
  }
}