Timer in textdraw - 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: Timer in textdraw (
/showthread.php?tid=481212)
Timer in textdraw -
Voxel - 14.12.2013
Hello fellow scripters,
Once again I stumbled on a problem :\, I want to display my round timer from 30 minutes in a textdraw which will count down and when it reaches 0 it will stop untill the new round starts. I tried to search but I had no luck in succeeding. I hope you guys can help me.
Code I got so far:
pawn Код:
forward NewRoundTimer(playerid);
public NewRoundTimer(playerid)
{
new InfoString[300];
new Min = 30, sec;
format(InfoString, sizeof(InfoString), "%d:%d", Min, sec);
TextDrawSetString(timer1, InfoString);
SetTimer("StartedNewRound",8000,false);
return 1;
}
public StartedNewRound()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SpawnPlayer(i);
SurvivorSpawn(i);
}
return 1;
}
public OnGameModeInit()
{
SetTimer("NewRoundTimer",1800000,true);
return 1;
}
Re: Timer in textdraw - Patrick - 14.12.2013
I believe this is what you want, you simple make the variable global and created a 1,000 mile seconds timer and decrease the variable by one
pawn Код:
forward NewRoundTimer( );
forward StartedNewRound( );
forward StartRoundTimer( );
new Minutes, Seconds;
public NewRoundTimer( )
{
new
InfoString[ 15 ];
format( InfoString, sizeof( InfoString ), "%d:%d", Minutes, Seconds );
TextDrawSetString( timer1, InfoString );
SetTimer("StartedNewRound", 8000, false);
return 1;
}
public StartedNewRound( )
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
SpawnPlayer( i );
SurvivorSpawn( i );
}
return 1;
}
public StartRoundTimer( )
{
if( Seconds <= 0 ) Minutes --;
return Seconds --;
}
public OnGameModeInit( )
{
SetTimer( "NewRoundTimer", 1800000, true );
SetTimer( "StartRoundTimer", 1000, true );
return 1;
}
Re: Timer in textdraw -
Voxel - 14.12.2013
Thank you, I will try it tomorrow!
Re: Timer in textdraw -
Voxel - 15.12.2013
Doesn't work :/.. maybe something is wrong with my textdraw?
pawn Код:
timer1 = TextDrawCreate(310.857208, 29.866657, "30:00");
TextDrawLetterSize(timer1, 0.449999, 1.600000);
TextDrawAlignment(timer1, 1);
TextDrawColor(timer1, -5963521);
TextDrawSetShadow(timer1, 0);
TextDrawSetOutline(timer1, 1);
TextDrawBackgroundColor(timer1, 255);
TextDrawFont(timer1, 2);
TextDrawSetProportional(timer1, 1);
Re: Timer in textdraw -
Voxel - 15.12.2013
Anyone?
Re: Timer in textdraw -
Pasa - 15.12.2013
Here is a .pwn that I made for your problem (i made something lake a side-script gamemode)