23.12.2010, 02:26
pawn Код:
new Text:VClockTD;
new Vhour, Vminute;
stock ToggleVClock(toggle)
{
if(toggle == 1)
{
VClockTD = TextDrawCreate(546.000000,23.000000,"6:30 AM");
TextDrawAlignment(VClockTD,0);
TextDrawBackgroundColor(VClockTD,0x000000ff);
TextDrawFont(VClockTD,3);
TextDrawLetterSize(VClockTD,0.299999,1.600000);
TextDrawColor(VClockTD,0xFFFFFFFF);
TextDrawSetProportional(VClockTD,1);
TextDrawSetShadow(VClockTD,1);
TextDrawShowForAll(VClockTD);
SetTimer("VClock", 30000, true);
SetWorldTime(6);
Vhour = 6;
Vminute = 30;
}
return 0;
}
public OnFilterScriptInit()
{
ToggleVClock(1);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid,VClockTD)
return 1;
}
forward VClock(playerid);
public VClock(playerid)
{
Vminute++;
if(Vminute >= 60)
{
Vminute = 0;
Vhour++;
if(Vhour >= 24)
{
Vhour = 0;
SetWorldTime(Vhour);
}
}
new string[20];
format(string,sizeof(string),"%d:%.02d %s",Vhour,Vminute,(Vhour >= 12) ? ("PM") : ("AM"));
TextDrawSetString(VClockTD,string);
return 1;
}