Az egyik barátomnak írtam egy ilyesmit, csak neki a nap is kellett bele, mivel karácsonyig kellett a visszaszámlálás.
Szerintem át tudod belõle alakítani, itt a forrásom:
#include < a_samp >
#define COLOR_GREEN 0x38FF06FF
new Text: Counttext[ MAX_PLAYERS ],
Timer[ MAX_PLAYERS ],
y, mon, d,
h, minu, s,
z[ 128 ];
public SetString( playerid );
public OnFilterScriptInit( ) {
for( new playerid = 0; playerid < GetMaxPlayers( ); playerid++ ) {
Counttext[ playerid ] = TextDrawCreate( 220.0, 419.0, \"_\" );
TextDrawAlignment( Counttext[ playerid ], 1 );
TextDrawFont( Counttext[ playerid ], 1 );
TextDrawLetterSize( Counttext[ playerid ], 0.49, 1.70 );
TextDrawColor( Counttext[ playerid ], COLOR_GREEN );
TextDrawSetShadow( Counttext[ playerid ], 2 );
getdate( y, mon, d );
gettime( h, minu, s );
d = 24 - d;
h = 24 - h;
minu = 60 - minu;
format( z, sizeof z, \"M¾g %i nap, %i ¦ra, %i perc van Karcsonyig!\", d, h, minu );
TextDrawSetString( Counttext[ playerid ], z );
TextDrawShowForPlayer( playerid, Counttext[ playerid ] );
Timer[ playerid ] = SetTimerEx( \"SetString\", 60000, true, \"i\", playerid );
}
return 1;
}
public OnFilterScriptExit( ) {
for( new playerid = 0; playerid < GetMaxPlayers( ); playerid++ ) {
TextDrawDestroy( Counttext[ playerid ] );
KillTimer( Timer[ playerid ] );
}
return 1;
}
public OnPlayerConnect( playerid ) return ShowTextdraw( playerid );
public OnPlayerDisconnect( playerid, reason ) return TextDrawDestroy( Counttext[ playerid ] ), KillTimer( Timer[ playerid ] );
public SetString( playerid ) {
getdate( y, mon, d );
gettime( h, minu, s );
d = 24 - d;
h = 24 - h;
minu = 60 - minu;
format( z, sizeof z, \"M¾g %i nap, %i ¦ra, %i perc van Karcsonyig!\", d, h, minu );
TextDrawSetString( Counttext[ playerid ], z );
return 1;
}
ShowTextdraw( playerid ) {
Counttext[ playerid ] = TextDrawCreate( 1.0, 419.0, \"_\" );
TextDrawAlignment( Counttext[ playerid ],0 );
TextDrawFont( Counttext[ playerid ], 0 );
TextDrawLetterSize( Counttext[ playerid ], 0.89, 3.0 );
TextDrawColor( Counttext[ playerid ], COLOR_GREEN );
TextDrawSetShadow( Counttext[ playerid ], 5 );
getdate( y, mon, d );
gettime( h, minu, s );
d = 24 - d;
h = 24 - h;
minu = 60 - minu;
format( z, sizeof z, \"M¾g %i nap, %i ¦ra, %i perc van Karcsonyig!\", d, h, minu );
TextDrawSetString( Counttext[ playerid ], z );
TextDrawShowForPlayer( playerid, Counttext[ playerid ] );
Timer[ playerid ] = SetTimerEx( \"SetString\", 60000, true, \"i\", playerid );
return 1;
}
ZeRo