20.08.2010, 16:21
pawn Code:
#include <a_samp>
forward ClockSync(playerid);
new Text:Clock;
new chour, cmin;
public OnFilterScriptInit()
{
Clock = TextDrawCreate(547.000000,24.000000,"00:00");
TextDrawAlignment(Clock,0);
TextDrawBackgroundColor(Clock,0x000000ff);
TextDrawFont(Clock,3);
TextDrawLetterSize(Clock,0.6,1.9);
TextDrawColor(Clock,0xffffffff);
TextDrawSetOutline(Clock,2);
TextDrawSetProportional(Clock,1);
TextDrawSetShadow(Clock,1);
SetTimer("ClockSync", 1000, 1);
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,Clock);
return 1;
}
public OnPlayerDeath(playerid)
{
TextDrawHideForPlayer(playerid,Clock);
return 1;
}
public ClockSync(playerid)
{
new string[64];
if(cmin == 59)
{
cmin = 0;
if(chour == 23) chour = 0;
else chour++;
}
else cmin++;
for(new i=0; i<GetMaxPlayers(); i++) if(GetPlayerState(i) != PLAYER_STATE_NONE && IsPlayerConnected(i)) SetPlayerTime(i,chour,cmin);
format(string, 64, "%02d:%02d", chour, cmin);
TextDrawSetString(Text:Clock, string);
SetWorldTime(chour);
}

