New weather changing, and TogglePlayerClock problem
#1

I have this code
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);
    }  
}
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:
Код:
  for(new i=0; i<MAX_PLAYERS; i++)
  {    
    SetPlayerTime(i, T_HOUR, T_MIN);
  }
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!
Reply
#2

i have the same problem as i'm syncing every players time with SetPlayerTime(playerid,hour,minute); but after i do this the weathers just change instantly instead of gradually is there any fix around this so that players time is synced aswell as the weather changing gradually?
Reply
#3

Anybody knows? BTW, i tried different code combinations and i didnt find the solve of the problem.
Reply
#4

The weather interpolation will work only with TogglePlayerClock, if SetPlayerTime is used it wont work.
Reply
#5

Thats true, but in order to sync the time for every player you NEED to work with SetPlayerTime. Or is there any other possibility?
Reply
#6

LOL, i need this too. But i think its impossible now untill kye will not repair this or make a new command (like a: ToggleWeatherGradualy(toggle)). But SAMP is feature lock down for now! This is a problem...
Reply
#7

Theres no need for a
Код:
ToggleWeatherGradualy(toggle);
cause it would be enough if if you could use SetWeather with SetPlayerTime and the Weather changes like in SP...
Reply
#8

Thats the problem! If you using SetPlayerTime, than weather changing is not gradualy like in SP!
Reply
#9

You could SetPlayerTime, in OnPlayerSpawn the player's time will be a few seconds off but then the smooth weather changing will work.
Reply
#10

What about using timer? I need to have the same time for all players. But When i add this under timer , it wont work.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)