Textdraw Counter
#1

Hello This is my script
Код:
RobberyTime = TextDrawCreate(460.000000, 290.000000, "Robbery: Time :");
TextDrawBackgroundColor(RobberyTime, 255);
TextDrawFont(RobberyTime, 2);
TextDrawLetterSize(RobberyTime, 0.500000, 1.000000);
TextDrawColor(RobberyTime, -16776961);
TextDrawSetOutline(RobberyTime, 0);
TextDrawSetProportional(RobberyTime, 1);
TextDrawSetShadow(RobberyTime, 4);
TextDrawUseBox(RobberyTime, 1);
TextDrawBoxColor(RobberyTime, 1313359944);
TextDrawTextSize(RobberyTime, 594.000000, 69.000000);

RobberyCountDown = TextDrawCreate(562.000000, 293.000000, "20");
TextDrawBackgroundColor(RobberyCountDown, 255);
TextDrawFont(RobberyCountDown, 1);
TextDrawLetterSize(RobberyCountDown, 0.500000, 1.000000);
TextDrawColor(RobberyCountDown, -16776961);
TextDrawSetOutline(RobberyCountDown, 0);
TextDrawSetProportional(RobberyCountDown, 0);
TextDrawSetShadow(RobberyCountDown, 1);
I want that RobberyCountDown to decrease after every secs .. when it reaches 0 then TextDrawDestroy.. Please Help .. for rep +1
Reply
#2

pawn Код:
// top of your script
new C, CountTimer;

// Textdraw
RobberyCountDown = TextDrawCreate(562.000000, 293.000000, "20");
TextDrawBackgroundColor(RobberyCountDown, 255);
TextDrawFont(RobberyCountDown, 1);
TextDrawLetterSize(RobberyCountDown, 0.500000, 1.000000);
TextDrawColor(RobberyCountDown, -16776961);
TextDrawSetOutline(RobberyCountDown, 0);
TextDrawSetProportional(RobberyCountDown, 0);
TextDrawSetShadow(RobberyCountDown, 1);
// after you made the textdraw
CountTimer = SetTimer("Count", 1000, true); // set a timer that will call the forwarded public Count every 1 second
C = 20; // Set the count to 20
pawn Код:
forward Count();
public Count()
{
    C --;
    new str[8];
    format(str, sizeof(str), "%d", C);
    TextDrawSetString(RobberyCountDown, str);
    if(C == 0) // when the count down ends
    {
        KillTimer(CountTimer);
        TextDrawDestroy(RobberyCountDown);
        // other stuff
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)