Countdown in area help (textdraw)
#1

Ai, so i need some help with my countdown system, I want the countdown to be shown for "all" the players in a certain range I defined.
The problem is, the textdraw doesn't even show. I really dunno where's the problem.

Heres the code:

Top:
pawn Код:
forward Countdown(Float:range, Float:x, Float:y, Float:z);

new CountDown[MAX_PLAYERS];
new CountDownTimer[MAX_PLAYERS];
new bool:auts;
OnGameModeInit:
pawn Код:
//Textdraw by RenisiL
    Textdraw0 = TextDrawCreate(264.000000,367.000000,"~w~- ~r~C~r~~h~o~r~u~r~~h~n~r~t~r~~h~D~r~o~r~~h~w~r~n ~w~-");
    TextDrawAlignment(Textdraw0, 0);
    TextDrawBackgroundColor(Textdraw0, 0x000000ff);
    TextDrawFont(Textdraw0, 1);
    TextDrawLetterSize(Textdraw0, 0.399999, 1.300000);
    TextDrawColor(Textdraw0, 0xffffffff);
    TextDrawSetOutline(Textdraw0, 1);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);
  for(new i = 0; i < MAX_PLAYERS; i++)
    {
        Textdraw1[i] = TextDrawCreate(304.000000, 384.000000, "_");
        TextDrawAlignment(Textdraw1[i], 0);
        TextDrawBackgroundColor(Textdraw1[i], 0x000000ff);
        TextDrawFont(Textdraw1[i], 3);
        TextDrawLetterSize(Textdraw1[i], 0.699999, 1.400000);
        TextDrawColor(Textdraw1[i], 0xffffffff);
        TextDrawSetOutline(Textdraw1[i], 1);
        TextDrawSetProportional(Textdraw1[i], 1);
        TextDrawSetShadow(Textdraw1[i], 1);
    }
Middl:
pawn Код:
COMMAND:count(playerid, params[])
{
    new string[128],
        sendername[MAX_PLAYER_NAME],
        Float:x, Float:y, Float:z,
        time;

    if(sscanf(params, "d", time)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /count [time in seconds]");
    if(time < 2 || time > 30) return SendClientMessage(playerid, COLOR_GRAD2, "  Time not greater than 30 seconds, nor below 1 second!");
    if(auts == false)
    {
        auts = true;
      CountDown[playerid] = time;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s started a countdown.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
       
      GetPlayerPos(playerid, x,y,z);
        CountDownTimer[playerid] = SetTimerEx("Countdown", 1000, true, "iffff", playerid,20.0,x,y,z);
    }
    else
    {
        SendClientMessage(playerid, 0xFF9900AA, "Another countdown is currently in progress, please wait!");
    }
    return 1;
}
At the end:
pawn Код:
////////////////////////////////////////////////////////////////////////////////
function Countdown(Float:range, Float:x, Float:y, Float:z)
{
    new string[64];
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(IsPlayerInRangeOfPoint(i, range, x,y,z))
      {
            if(CountDown[i] > 0 && CountDown[i] < 31)
          {
                TogglePlayerControllable(i, 0);
                format(string, sizeof(string), "%d", CountDown[i]);
                TextDrawSetString(Textdraw1[i], string);
                TextDrawShowForPlayer(i, Textdraw1[i]);
                TextDrawShowForPlayer(i, Textdraw0);
                CountDown[i]--;
            }
            else if(CountDown[i] >= -1) { KillTimer(CountDownTimer[i]); EndCountdown(i); }
            else
            {
                auts = false;
                KillTimer(CountDownTimer[i]);
                TogglePlayerControllable(i, 1);
                PlayerPlaySound(i, 1057, x, y, z);
                TextDrawSetString(Textdraw1[i], "~g~Go!!");
                SetTimerEx("EndCountdown", 500, false, "i", i);
            }
        }
    }
}
function EndCountdown(playerid)
{
    TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw0);
}
////////////////////////////////////////////////////////////////////////////////
Reply


Messages In This Thread
Countdown in area help (textdraw) - by Virtual1ty - 30.04.2010, 17:47
Re: Countdown in area help (textdraw) - by Nero_3D - 30.04.2010, 18:49
Re: Countdown in area help (textdraw) - by Virtual1ty - 30.04.2010, 19:07

Forum Jump:


Users browsing this thread: 1 Guest(s)