Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //pawn
- stock GetWeatherIDFromTime()
- {
- return floatround ( ( floatdiv((( floatround(gettime()/4001,floatround_floor) * 0x43FD43FD + 0xC39EC3 ) & 0xFFFFFF),16777216.0) * ( 100001 ) ), floatround_floor ) ;
- }
- forward T20minTimer();
- public T20minTimer()
- {
- SetWeather(WeatherArray[random(5)][(GetWeatherIDFromTime() % 132)]);
- }
- new WeatherArray[5][132] =
- {
- {
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,//43
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,7,8,10,11,12,13,14,15,//86
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,15,16,17,18,0,1,2,3//129
- },
- {
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,//43
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,7,8,10,11,12,13,14,15,//86
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,15,16,17,18,0,1,2,3//129
- },
- {
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,//43
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,7,8,10,11,12,13,14,15,//86
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,15,16,17,18,0,1,2,3//129
- },
- {
- 5,17,11,11,11,12,10,6,6,0,13,8,15,18,10,7,0,13,11,1,3,5,6,8,17,7,13,10,7,3,1,0,8,0,2,5,3,8,4,11,13,6,13,7,
- 12,18,7,18,10,17,2,12,3,10,8,14,1,11,7,17,1,1,8,13,2,3,13,15,14,15,14,2,3,8,15,5,4,12,18,10,15,15,5,12,13,14,4,8,
- 14,12,15,2,12,16,11,4,0,14,12,8,1,6,16,7,12,7,13,12,8,7,8,8,8,4,12,4,18,4,18,15,14,11,13,18,15,15,18,14,2,18,3,4
- },
- {
- 17,6,16,0,0,5,6,8,6,7,10,11,17,8,3,1,10,15,12,8,13,2,3,8,10,10,5,4,0,13,8,6,18,4,10,7,1,15,16,4,4,0,17,5,
- 7,15,14,2,8,10,2,6,0,18,11,2,18,12,2,7,4,2,14,17,6,11,5,16,0,0,2,1,15,17,2,16,12,8,10,5,2,13,1,2,4,10,18,5,
- 15,14,12,2,10,14,1,15,12,10,18,16,7,13,8,1,10,12,13,8,5,5,13,6,16,7,1,11,8,7,0,1,0,17,6,11,6,11,3,18,5,1,0,1
- }
- };
- //php
- <?php
- date_default_timezone_set("Europe/Amsterdam");
- $Weather = array(
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,//43
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,7,8,10,11,12,13,14,15,//86
- 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,15,16,17,18,0,1,2,3//129
- );//60%
- $Weather2 = array(
- 5,17,11,11,11,12,10,6,6,0,13,8,15,18,10,7,0,13,11,1,3,5,6,8,17,7,13,10,7,3,1,0,8,0,2,5,3,8,4,11,13,6,13,7,
- 12,18,7,18,10,17,2,12,3,10,8,14,1,11,7,17,1,1,8,13,2,3,13,15,14,15,14,2,3,8,15,5,4,12,18,10,15,15,5,12,13,14,4,8,
- 14,12,15,2,12,16,11,4,0,14,12,8,1,6,16,7,12,7,13,12,8,7,8,8,8,4,12,4,18,4,18,15,14,11,13,18,15,15,18,14,2,18,3,4
- );//20%
- $Weather3 = array(
- 17,6,16,0,0,5,6,8,6,7,10,11,17,8,3,1,10,15,12,8,13,2,3,8,10,10,5,4,0,13,8,6,18,4,10,7,1,15,16,4,4,0,17,5,
- 7,15,14,2,8,10,2,6,0,18,11,2,18,12,2,7,4,2,14,17,6,11,5,16,0,0,2,1,15,17,2,16,12,8,10,5,2,13,1,2,4,10,18,5,
- 15,14,12,2,10,14,1,15,12,10,18,16,7,13,8,1,10,12,13,8,5,5,13,6,16,7,1,11,8,7,0,1,0,17,6,11,6,11,3,18,5,1,0,1
- );//20%
- function GetWeatherIDFromTime($adder=0)
- {
- return floor ( ( ((( floor((time()+$adder)/4001) * 0x43FD43FD + 0xC39EC3 ) & 0xFFFFFF)/16777216.0) * ( 100001 ) ) ) ;
- }
- function GetWeatherName($id)
- {
- switch($id)
- {
- case 0: return "Blue Sky, Sunny";
- case 1: return "Blue Sky, Sunny";
- case 2: return "Blue Sky, Sunny";
- case 10: return "Blue Sky, Sunny";
- case 6: return "Blue Sky, Sunny";
- case 7: return "Blue Sky, Sunny";
- case 3: return "Blue Sky, Foggy";
- case 4: return "Blue Sky, Foggy";
- case 5: return "Blue Sky, Foggy";
- case 12: return "Dull, Hazy";
- case 13: return "Dull, Hazy";
- case 14: return "Dull, Hazy";
- case 15: return "Dull, Hazy";
- case 16: return "Storm, Rain";
- case 8 : return "Storm, Rain";
- case 11: return "Scorching Hot";
- case 17: return "Scorching Hot";
- case 18: return "Scorching Hot";
- case 9 : return "Cloudy And Foggy";
- }
- }
- function match_weather($num1,$num2)
- {
- if($num1 == $num2){return true;}
- if(
- ($num1 == 0 ||$num1 == 1 ||$num1 == 2 ||$num1 == 10 ||$num1 == 6 ||$num1 == 7)
- &&
- ($num2 == 0 ||$num2 == 1 ||$num2 == 2 ||$num2 == 10 ||$num2 == 6 ||$num2 == 7)
- ){return true;}
- if(
- ($num1 == 3 || $num1 == 4 || $num1 == 5)
- &&
- ($num2 == 3 || $num2 == 4 || $num2 == 5)
- ){return true;}
- if(
- ($num1 == 12 || $num1 == 13 || $num1 == 14 || $num1 == 15)
- &&
- ($num2 == 12 || $num2 == 13 || $num2 == 14 || $num2 == 15)
- ){return true;}
- if(
- ($num1 == 16 || $num1 == 8)
- &&
- ($num2 == 16 || $num2 == 8)
- ){return true;}
- if(
- ($num1 == 11 || $num1 == 17 || $num1 == 18)
- &&
- ($num2 == 11 || $num2 == 17 || $num2 == 18)
- ){return true;}
- return false;
- }
- $string = "";
- echo('<html><body><table border="1" cellpadding="0" cellspacing="0" width="100%">');
- echo("<tr><th>Date</th><th>20% chance</th><th>20% chance</th><th>40% chance</th><th>60% chance</th><th>80% chance</th><th>100% chance</th></tr>");
- for ($i = time(); $i <= time()+288000; $i=$i+3600)
- {
- $w1 = $Weather[GetWeatherIDFromTime($i) % 132];//60%
- $w2 = $Weather2[GetWeatherIDFromTime($i) % 132];//20%
- $w3 = $Weather3[GetWeatherIDFromTime($i) % 132];//20%
- $w1n = GetWeatherName($Weather[GetWeatherIDFromTime($i) % 132]);
- $w2n = GetWeatherName($Weather2[GetWeatherIDFromTime($i) % 132]);
- $w3n = GetWeatherName($Weather3[GetWeatherIDFromTime($i) % 132]);
- $datix = date('D d-m-Y H:00', $i);
- //"<tr><td>Date</td><td>20% chance</td><td>20% chance</td><td>40% chance</td><td>60% chance</td><td>80% chance</td><td>100% chance</td></tr>"
- if(!match_weather($w1,$w2) && !match_weather($w1,$w3) && !match_weather($w2,$w3))
- {
- $string .= "<tr><td>$datix</td><td>$w2n</td><td>$w3n</td><td>-</td><td>$w1n</td><td>-</td><td>-</td></tr>\n";
- }
- if(match_weather($w1,$w2) && !match_weather($w1,$w3) && !match_weather($w2,$w3))
- {
- $string .= "<tr><td>$datix</td><td>$w3n</td><td>-</td><td>-</td><td>-</td><td>$w1n</td><td>-</td></tr>\n";
- }
- if(!match_weather($w1,$w2) && match_weather($w1,$w3) && !match_weather($w2,$w3))
- {
- $string .= "<tr><td>$datix</td><td>$w2n</td><td>-</td><td>-</td><td>-</td><td>$w1n</td><td>-</td></tr>\n";
- }
- if(match_weather($w1,$w2) && match_weather($w1,$w3) && match_weather($w2,$w3))
- {
- $string .= "<tr><td>$datix</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>$w1n</td></tr>\n";
- }
- if(!match_weather($w1,$w2) && !match_weather($w1,$w3) && match_weather($w2,$w3))
- {
- $string .= "<tr><td>$datix</td><td>-</td><td>-</td><td>$w2n</td><td>$w1n</td><td>-</td><td>-</td></tr>\n";
- }
- }
- echo($string);
- echo('</table></body></html>');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement