Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- // Here will be the the configurations for the time. There will be the textdraw, hour, minutes and the string.
- new Text:TimerTextdraw;
- new hours, minutes;
- new realtime[32];
- // We're going to create the textdraw over here, so it will appear in game, and we're going to make the timer too.
- public OnFilterScriptInit()
- {
- TimerTextdraw = TextDrawCreate(557.000000, 20.000000, "00:00");
- TextDrawBackgroundColor(TimerTextdraw, 255);
- TextDrawFont(TimerTextdraw, 1);
- TextDrawLetterSize(TimerTextdraw, 0.549999, 3.199999);
- TextDrawColor(TimerTextdraw, -1);
- TextDrawSetOutline(TimerTextdraw, 1);
- TextDrawSetProportional(TimerTextdraw, 0);
- TextDrawUseBox(TimerTextdraw, 1);
- TextDrawBoxColor(TimerTextdraw, 595);
- TextDrawTextSize(TimerTextdraw, 618.000000, 4.000000);
- TimeUpdater();
- SetTimer("UpdateTime", 1000 * 60, 1);
- return 1;
- }
- // This is the end of the configurations.
- // This is the public that that will be created to update the clock shown in the screen.
- forward TimeUpdater();
- public TimeUpdater()
- {
- gettime(hours, minutes);
- format(realtime, 32, "%02d:%02d", hours, minutes);
- TextDrawSetString(TimerTextdraw, realtime);
- SetWorldTime(hours);
- new x=0;
- while(x!=MAX_PLAYERS) {
- if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
- SetPlayerTime(x, hours, minutes);
- }
- x++;
- }
- }
- public OnPlayerSpawn(playerid)
- {
- TextDrawShowForPlayer(playerid, TimerTextdraw);
- gettime(hours, minutes);
- SetPlayerTime(playerid, hours, minutes);
- return 1;
- }
- public OnPlayerDeath(playerid)
- {
- TextDrawHideForPlayer(playerid, TimerTextdraw);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- gettime(hours, minutes);
- SetPlayerTime(playerid, hours, minutes);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement