SA-MP Forums Archive
Textdraw timer.. - 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)
+--- Thread: Textdraw timer.. (/showthread.php?tid=424916)



Textdraw timer.. - Anak - 24.03.2013

hello.. i have created an textdraw timer .. timer works fine .. but textdraw timer on screen does not respond ..
i want to show it like
"in 10 seconds"
"in 9 seconds"
"in 8 seconds"

etc..

here are codes

pawn Код:
new Time;
new TimeM;
new TimeS;


// filterscript int,,

Textdraw15 = TextDrawCreate(308.000000, 347.000000, "~n~~y~this box will close automatically in~n~~p~10 seconds.");
TextDrawAlignment(Textdraw15, 2);
TextDrawBackgroundColor(Textdraw15, 255);
TextDrawFont(Textdraw15, 2);
TextDrawLetterSize(Textdraw15, 0.500000, 1.000000);
TextDrawColor(Textdraw15, -1);
TextDrawSetOutline(Textdraw15, 0);
TextDrawSetProportional(Textdraw15, 1);
TextDrawSetShadow(Textdraw15, 1);
TextDrawUseBox(Textdraw15, 1);
TextDrawBoxColor(Textdraw15, 999999);
TextDrawTextSize(Textdraw15, 14.000000, 388.000000);
TextDrawSetSelectable(Textdraw15, 0);
TimeM = 0;
TimeS = 10;

// in command ..
Time = SetTimerEx("CREDITS_TIMER", 10*1000, false, "i", playerid);
//

forward CREDITS_TIMER(playerid);

public CREDITS_TIMER(playerid)
{
TextDrawHideForPlayer(playerid, Textdraw15);

new Str[34];
TimeS --;
if(TimeM == 0 && TimeS == 0)
{
KillTimer(Time);
}

TimeS = 10;

format(Str, sizeof(Str), "~n~~y~this box will close automatically in~n~~p~%02d seconds.",  TimeS);
TextDrawSetString(Textdraw15, Str);
return 1;
}
any help?


Re: Textdraw timer.. - Anak - 24.03.2013

three hours .. not a single reply :S .. i need solution please !


Re: Textdraw timer.. - vitorvlv - 24.03.2013

Try this, not tested
pawn Код:
forward CREDITS_TIMER(playerid);
public CREDITS_TIMER(playerid)
{
TextDrawHideForPlayer(playerid, Textdraw15);

new Str[34];
if(TimeM == 0 && TimeS == 0)
{
KillTimer(Time);
TimeS = 10;
}

format(Str, sizeof(Str), "~n~~y~this box will close automatically in~n~~p~%d seconds.",  TimeS);
TextDrawSetString(Textdraw15, Str);
SetTimer("CREDITS_TIMER",1000,false);
return TimeS--;
}



Re: Textdraw timer.. - por12802 - 24.03.2013

Why u hide that textdraw?


Re: Textdraw timer.. - vitorvlv - 24.03.2013

Quote:
Originally Posted by por12802
Посмотреть сообщение
Why u hide that textdraw?
you're right, I had only seen this now.
why hide TextDraw? .-.

pawn Код:
forward CREDITS_TIMER(playerid);
public CREDITS_TIMER(playerid)
{
new Str[34];
if(TimeM == 0 && TimeS == 0)
{
KillTimer(Time);
TimeS = 10;
}

format(Str, sizeof(Str), "~n~~y~this box will close automatically in~n~~p~%d seconds.",  TimeS);
TextDrawSetString(Textdraw15, Str);
SetTimer("CREDITS_TIMER",1000,false);
return TimeS--;
}



Re: Textdraw timer.. - Anak - 24.03.2013

works not can some one show me some other way to do that..