SA-MP Forums Archive
How to i can - 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: How to i can (/showthread.php?tid=658268)



How to i can - Thanks - 30.08.2018

How to i can creating a time textdraws? Such as 05:00 When ending the timer the player must die how to do this with TEXTDRAWS?


Re: How to i can - NeXTGoD - 30.08.2018

By using format and TextDrawSetString


Re: How to i can - Shinja - 30.08.2018

Create your textdraw and set a timer that repeats every second where you decrease the time everytime its called and use TextDrawSetString


Re: How to i can - UFF - 31.08.2018

I got this code from an old help thread. Credits to @Jeffry


At top of your script.
Код:
 
new Time, TimeM, TimeS;
new Text:Textdraw0;
OnFilterScriptInit/OnGameModeInit (The textdraw used here is just a example)
Код:
Textdraw0 = TextDrawCreate(17.000000, 429.000000, "20:00");
TextDrawBackgroundColor(Textdraw0, 65535);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, 16777215);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
TimeM = 20; 
TimeS = 0;
Time = SetTimer("UpdateTime", 1000, true);
OnPlayerConnect
Код:
TextDrawShowForPlayer(playerid, Textdraw0);
On Bottom of your script
Код:
forward UpdateTime();
public UpdateTime()
{
  new Str[34];
  TimeS --;
  if(TimeM == 0 && TimeS == 0)
  {
    KillTimer(Time);
  }
  if(TimeS == -1)
  {
    TimeM--;
    TimeS = 59;
  }
  format(Str, sizeof(Str), "%02d:%02d", TimeM, TimeS);
  TextDrawSetString(Textdraw0, Str);
  return 1;
}
Good Luck. Hope you understand.