Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- - Sistema de Clima -
- - Autor: [J]ulian ( Script Base: http://forum.sa-mp.com/showthread.php?t=273751 ).
- - Para: sa-mp.com
- */
- #include <a_samp>
- new TiempoTimer, rand;
- #define TIEMPO_MIN 3 // Tiempo mínimo.
- #define MAX_RANDOM 6 // Random porque cual se multiplicará nuestro tiempo ( 3, 6, 9, 12, 15 minutos... )
- public OnGameModeInit()
- {
- TiempoActualizar();
- rand = random(MAX_RANDOM);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp("/tiempo", cmdtext, true))
- {
- SendClientMessage(playerid, -1, "* Has actualizado a un nuevo tiempo.");
- TiempoActualizar();
- }
- return 1;
- }
- forward TiempoActualizar();
- public TiempoActualizar()
- {
- new
- tiempo[2];
- gettime(tiempo[0], tiempo[1]);
- SetWorldTime(tiempo[0]);
- if(7 < tiempo[0] && tiempo[0] < 17)
- {
- new WeatherDia[] = { 2, 4, 7, 8, 9, 12, 15, 19, 21, 25, 27 };
- rand = random(10);
- SetWeather(random(WeatherDia[rand]));
- SendClientMessageToAll(-1, "* El tiempo de día fue cambiado automáticamente.");
- printf("Weather Dia: \"%i\".", rand);
- }
- else
- {
- new WeatherNoche[7] = { 16, 32, 38, 42, 43, 50 };
- rand = random(6);
- SetWeather(random(WeatherNoche[rand]));
- SendClientMessageToAll(-1, "* El tiempo de noche fue cambiado automáticamente.");
- printf("Weather Noche: \"%i\".", rand);
- }
- KillTimer(TiempoTimer);
- rand = random(MAX_RANDOM);
- TiempoTimer = SetTimer("TiempoActualizar", ( TIEMPO_MIN * 60000 ) * rand, true);
- printf("Nuevo tiempo en: \"%i\" minutos.", TIEMPO_MIN * rand );
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement