Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Synchronised Player Clock By CatFish
- //Feel free to do anything to it
- #include <a_samp>
- #define TimeTimer 1 //In Seconds - Time of which minutes will pass
- #define StartHour 00 //24 hour time - 14 for 2pm eg.
- static
- whour,
- wminute;
- new Text:Timet;
- forward Time();
- public OnPlayerConnect(playerid)
- {
- Time();
- TextDrawShowForPlayer(playerid, Text:Timet);
- }
- public OnGameModeInit()
- {
- SetWorldTime(StartHour);
- whour = StartHour;
- wminute = 00;
- Time();
- SetTimer("Time", TimeTimer*1000, true);
- new timem[6];
- format(timem, 128, "%02d:%02d",whour,wminute);
- Timet = TextDrawCreate(551, 35, timem);
- TextDrawFont(Timet , 3);
- TextDrawLetterSize(Timet , 0.60, 2.0); //0.58 1.9
- TextDrawColor(Timet , 0xFFFFFFFF);
- TextDrawSetOutline(Timet , 1);
- TextDrawSetProportional(Timet , 1);
- TextDrawSetShadow(Timet , 1);
- }
- public Time()
- {
- if(wminute == 59)
- {
- if(whour == 23) whour = 00, wminute = 00;
- else whour++, wminute = 00;
- }
- else wminute++;
- for(new p = 0; p < MAX_PLAYERS; p++)
- {
- if(IsPlayerConnected(p) && GetPlayerState(p) != PLAYER_STATE_NONE)
- {
- SetPlayerTime(p, whour, wminute);
- new timem[6];
- format(timem,128,"%02d:%02d",whour,wminute);
- TextDrawSetString(Text:Timet, timem);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment