Testdraw countdown help? -
vvhy - 23.04.2012
I got this rob script and players want to know how long it will take to finish robbing it, I just need a textdraw countdown for 30 seconds at the bottom of the screen...I've tried it and can't get it to work could someone help?
Re: Testdraw countdown help? -
MP2 - 23.04.2012
https://sampforum.blast.hk/showthread.php?tid=290640
https://sampwiki.blast.hk/wiki/TextDrawSetString
https://sampwiki.blast.hk/wiki/format
Re: Testdraw countdown help? -
Ballu Miaa - 23.04.2012
This callback has a CountDown to be inputted and it will be displayed as a GameTextForPlayer. You can edit it accordingly
pawn Код:
//Countdown
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
new string[50];
if(seconds > 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1056, X, Y, Z);
format(string, sizeof(string), "~R~%d", seconds);
GameTextForPlayer(playerid, string, 1000, 3);
seconds = seconds -1;
SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
return 1;
}
if(seconds == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1057, X, Y, Z);
GameTextForPlayer(playerid, "~G~Start!!!", 1000, 3);
TogglePlayerControllable(playerid, 1);
return 1;
}
return 1;
}
How to use this callback?
pawn Код:
// THIS WILL SHOW YOU COUNTDOWN OF 500 Seconds.
CountDown(playerid, 500);
Re: Testdraw countdown help? -
vvhy - 23.04.2012
game text makes people lag when its a countdown, I've tried it
Re: Testdraw countdown help? -
Ballu Miaa - 23.04.2012
Quote:
Originally Posted by vvhy
game text makes people lag when its a countdown, I've tried it
|
Try this one then. Just created for you [UNTESTED]
pawn Код:
//Countdown
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
new string[50];
if(seconds > 0)
{
new Text:TextdrawCT;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "~R~%d", seconds);
TextdrawCT = TextDrawCreate(262.000000, 163.000000, "string");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -16776961);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
PlayerPlaySound(playerid, 1056, X, Y, Z);
TextDrawShowForPlayer(playerid,TextdrawCT);
seconds = seconds -1;
SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
return 1;
}
if(seconds == 0)
{
new Text:TextdrawCT1;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, 1057, X, Y, Z);
TextdrawCT = TextDrawCreate(262.000000, 163.000000, "GO..");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -16776961);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TogglePlayerControllable(playerid, 1);
return 1;
}
return 1;
}