23.12.2010, 02:05
pawn Код:
public OnFilterScriptInit()
{
SetWorldTime(6);
Vhour = 6;
Vminute = 30;
SetTimer("VClock", 30000, true);
ToggleVClock(1);
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;
}
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;
}
}
if(Vhour == 0) return SetWorldTime(0);
if(Vhour == 1) return SetWorldTime(1);
if(Vhour == 2) return SetWorldTime(2);
if(Vhour == 3) return SetWorldTime(3);
if(Vhour == 4) return SetWorldTime(4);
if(Vhour == 5) return SetWorldTime(5);
if(Vhour == 6) return SetWorldTime(6);
if(Vhour == 7) return SetWorldTime(7);
if(Vhour == 8) return SetWorldTime(8);
if(Vhour == 9) return SetWorldTime(9);
if(Vhour == 10) return SetWorldTime(10);
if(Vhour == 11) return SetWorldTime(11);
if(Vhour == 12) return SetWorldTime(12);
if(Vhour == 13) return SetWorldTime(13);
if(Vhour == 14) return SetWorldTime(14);
if(Vhour == 15) return SetWorldTime(15);
if(Vhour == 16) return SetWorldTime(16);
if(Vhour == 17) return SetWorldTime(17);
if(Vhour == 18) return SetWorldTime(18);
if(Vhour == 19) return SetWorldTime(19);
if(Vhour == 20) return SetWorldTime(20);
if(Vhour == 21) return SetWorldTime(21);
if(Vhour == 22) return SetWorldTime(22);
if(Vhour == 23) return SetWorldTime(23);
return 1;
}
return 1;
}