11.10.2009, 18:27
I have this code
Weather changing is now like in GTA SA SP. But i want to set player time with this, because i want that all players have the same time:
under public RealHourUpdate. And when i do this, than weather wont work anymore like in GTA SA SP. I mean it change imidiately from sun to rain etc. How can i make this script to solve this problem?
thank you for help!
pawn Код:
#include <a_samp>
forward RealHourUpdate();
new T_MIN=0, T_HOUR=19, T_DAY=0;
new Text:DAN;
public OnPlayerSpawn(playerid)
{
TogglePlayerClock(playerid, 1);
TextDrawShowForPlayer(playerid, DAN);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
TextDrawHideForPlayer(playerid, DAN);
return 1;
}
public OnFilterScriptInit()
{
DAN = TextDrawCreate(497.000000, 5.000000, "----");
TextDrawFont(DAN, 3);
TextDrawLetterSize(DAN, 0.6, 1.5);
TextDrawSetOutline(DAN, 2);
TextDrawSetProportional(DAN, 1);
TextDrawSetShadow(DAN, 1);
SetTimer("RealHourUpdate", 1000, true);
return 1;
}
public RealHourUpdate()
{
T_MIN++;
if(T_MIN == 60)
{
T_MIN=0;
T_HOUR++;
}
if(T_HOUR == 24)
{
T_HOUR=0;
T_DAY++;
}
if(T_DAY == 7)
{
T_DAY=0;
}
if(T_DAY == 0)
{
TextDrawSetString(DAN,"Ponedeljek");
new string[]="Ponedeljek";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 1)
{
TextDrawSetString(DAN,"Torek");
new string[]="Torek";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 2)
{
TextDrawSetString(DAN,"Sreda");
new string[]="Sreda";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 3)
{
TextDrawSetString(DAN,"Cetrtek");
new string[]="Cetrtek";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 4)
{
TextDrawSetString(DAN,"Petek");
new string[]="Petek";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 5)
{
TextDrawSetString(DAN,"Sobota");
new string[]="Sobota";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 6)
{
TextDrawSetString(DAN,"Nedelja");
new string[]="Nedelja";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
}
Код:
for(new i=0; i<MAX_PLAYERS; i++) { SetPlayerTime(i, T_HOUR, T_MIN); }
thank you for help!