Rumun
Wiek: 30 Na forum: 5235 dni Posty: 316
Nick w MP: Rumun
Piwa : 25
Witam.Mam problem z odliczaniem w tekstdrawie.Nie wiem co mo?e by? ?le.Po wpisaniu cmd wyskakuje td z ilo?ci? sekund i nie odlicza w d??.?adnych b??d?w przy kompikacji. Oto kod:
Kod: new CountdownTime;
new Text:tdCountdown;
new bool:Countdown;
tdCountdown = TextDrawCreate(320.0, 302.0, "0");
TextDrawUseBox(tdCountdown, 1);
TextDrawBoxColor(tdCountdown, 0x00000033);
TextDrawTextSize(tdCountdown, 514.0, -645.0);
TextDrawAlignment(tdCountdown, 2);
TextDrawBackgroundColor(tdCountdown, 0x000000ff);
TextDrawFont(tdCountdown, 3);
TextDrawLetterSize(tdCountdown, 1.199999, 3.8);
TextDrawColor(tdCountdown, 0xffffffff);
TextDrawSetOutline(tdCountdown, 1);
TextDrawSetProportional(tdCountdown, 1);
TextDrawSetShadow(tdCountdown, 1);
COMMAND:odlicz1(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xC40707FF, " Komenda dost?pna tylko dla administratora.");
return 1;
}
if(strlen(params) < 1 || !isNumeric(params))
{
SendClientMessage(playerid, 0xC40707FF, "Wpisz: /oblicz1[sekundy]");
return 1;
}
new CDTimer = strval(params);
if(CDTimer < 1 || CDTimer > 60)
{
SendClientMessage(playerid, 0xC40707FF, "Podano b??dny czas (1-60).");
return 1;
}
if(Countdown)
StopCountdown();
StartCountdown(CDTimer);
return 1;
}
StartCountdown(CDTimer)
{
CountdownTime = CDTimer;
Countdown = true;
format(String, sizeof(String), "%d", CDTimer);
TextDrawSetString(tdCountdown, String);
TextDrawShowForAll(tdCountdown);
}
StopCountdown()
{
CountdownTime = 0;
Countdown = false;
TextDrawHideForAll(tdCountdown);
}
UpdateCountdown()
{
CountdownTime--;
if(CountdownTime == 0)
{
format(String, sizeof(String), "~y~start");
}
else if(CountdownTime > 0)
{
format(String, sizeof(String), "%d", CountdownTime);
}
else
StopCountdown();
TextDrawSetString(tdCountdown, String);
}
forward GlobalFunc();
public GlobalFunc()
{
if(Countdown)
UpdateCountdown();
return 1;
}
Za pomoc piwko i respect.