Advertisement
Gamer_Z

Untitled

Feb 29th, 2012
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.94 KB | None | 0 0
  1. //pawn
  2. stock GetWeatherIDFromTime()
  3. {
  4.     return floatround ( ( floatdiv((( floatround(gettime()/4001,floatround_floor) * 0x43FD43FD + 0xC39EC3 ) & 0xFFFFFF),16777216.0) * ( 100001 ) ), floatround_floor ) ;
  5. }
  6.  
  7. forward T20minTimer();
  8. public T20minTimer()
  9. {
  10.     SetWeather(WeatherArray[random(5)][(GetWeatherIDFromTime() % 132)]);
  11. }
  12.  
  13. new WeatherArray[5][132] =
  14. {
  15.     {
  16.         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
  17.         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
  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,8,10,11,12,13,14,15,16,17,18,15,16,17,18,0,1,2,3//129
  19.     },
  20.     {
  21.         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
  22.         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
  23.         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
  24.     },
  25.     {
  26.         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
  27.         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
  28.         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
  29.     },
  30.     {
  31.         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,
  32.         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,
  33.         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
  34.     },
  35.     {
  36.         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,
  37.         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,
  38.         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
  39.     }
  40. };
  41. //php
  42. <?php
  43.     date_default_timezone_set("Europe/Amsterdam");
  44.     $Weather = array(
  45.         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
  46.         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
  47.         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
  48.     );//60%
  49.  
  50.     $Weather2 = array(
  51.         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,
  52.         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,
  53.         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
  54.     );//20%
  55.     $Weather3 = array(
  56.         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,
  57.         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,
  58.         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
  59.     );//20%
  60.  
  61.  
  62.     function GetWeatherIDFromTime($adder=0)
  63.     {
  64.         return floor ( ( ((( floor((time()+$adder)/4001) * 0x43FD43FD + 0xC39EC3 ) & 0xFFFFFF)/16777216.0) * ( 100001 ) ) ) ;
  65.     }
  66.    
  67.     function GetWeatherName($id)
  68.     {
  69.         switch($id)
  70.         {
  71.             case 0:     return "Blue Sky, Sunny";
  72.             case 1:     return "Blue Sky, Sunny";
  73.             case 2:     return "Blue Sky, Sunny";
  74.             case 10:    return "Blue Sky, Sunny";
  75.             case 6:     return "Blue Sky, Sunny";
  76.             case 7:     return "Blue Sky, Sunny";
  77.             case 3:     return "Blue Sky, Foggy";
  78.             case 4:     return "Blue Sky, Foggy";
  79.             case 5:     return "Blue Sky, Foggy";
  80.             case 12:    return "Dull, Hazy";
  81.             case 13:    return "Dull, Hazy";
  82.             case 14:    return "Dull, Hazy";
  83.             case 15:    return "Dull, Hazy";
  84.             case 16:    return "Storm, Rain";
  85.             case 8 :    return "Storm, Rain";
  86.             case 11:    return "Scorching Hot";
  87.             case 17:    return "Scorching Hot";
  88.             case 18:    return "Scorching Hot";
  89.             case 9 :    return "Cloudy And Foggy";
  90.         }
  91.     }
  92.     function match_weather($num1,$num2)
  93.     {
  94.         if($num1 == $num2){return true;}
  95.         if(
  96.             ($num1 == 0 ||$num1 == 1 ||$num1 == 2 ||$num1 == 10 ||$num1 == 6 ||$num1 == 7)
  97.             &&
  98.             ($num2 == 0 ||$num2 == 1 ||$num2 == 2 ||$num2 == 10 ||$num2 == 6 ||$num2 == 7)
  99.         ){return true;}
  100.         if(
  101.             ($num1 == 3 || $num1 == 4 || $num1 ==  5)
  102.             &&
  103.             ($num2 == 3 || $num2 == 4 || $num2 ==  5)
  104.         ){return true;}
  105.         if(
  106.             ($num1 == 12 || $num1 == 13 || $num1 == 14 || $num1 == 15)
  107.         &&
  108.             ($num2 == 12 || $num2 == 13 || $num2 == 14 || $num2 == 15)
  109.         ){return true;}
  110.         if(
  111.             ($num1 == 16 || $num1 == 8)
  112.         &&
  113.             ($num2 == 16 || $num2 == 8)
  114.         ){return true;}
  115.         if(
  116.             ($num1 == 11 || $num1 == 17 || $num1 == 18)
  117.         &&
  118.             ($num2 == 11 || $num2 == 17 || $num2 == 18)
  119.         ){return true;}
  120.         return false;
  121.     }
  122.    
  123.     $string = "";
  124.     echo('<html><body><table border="1" cellpadding="0" cellspacing="0" width="100%">');
  125.     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>");
  126.     for ($i = time(); $i <= time()+288000; $i=$i+3600)
  127.     {
  128.         $w1 = $Weather[GetWeatherIDFromTime($i) % 132];//60%
  129.         $w2 = $Weather2[GetWeatherIDFromTime($i) % 132];//20%
  130.         $w3 = $Weather3[GetWeatherIDFromTime($i) % 132];//20%
  131.         $w1n = GetWeatherName($Weather[GetWeatherIDFromTime($i) % 132]);
  132.         $w2n = GetWeatherName($Weather2[GetWeatherIDFromTime($i) % 132]);
  133.         $w3n = GetWeatherName($Weather3[GetWeatherIDFromTime($i) % 132]);
  134.         $datix = date('D d-m-Y H:00', $i);
  135.         //"<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>"
  136.         if(!match_weather($w1,$w2) && !match_weather($w1,$w3) && !match_weather($w2,$w3))
  137.         {
  138.             $string .= "<tr><td>$datix</td><td>$w2n</td><td>$w3n</td><td>-</td><td>$w1n</td><td>-</td><td>-</td></tr>\n";
  139.         }
  140.         if(match_weather($w1,$w2) && !match_weather($w1,$w3) && !match_weather($w2,$w3))
  141.         {
  142.             $string .= "<tr><td>$datix</td><td>$w3n</td><td>-</td><td>-</td><td>-</td><td>$w1n</td><td>-</td></tr>\n";
  143.         }
  144.         if(!match_weather($w1,$w2) && match_weather($w1,$w3) && !match_weather($w2,$w3))
  145.         {
  146.             $string .= "<tr><td>$datix</td><td>$w2n</td><td>-</td><td>-</td><td>-</td><td>$w1n</td><td>-</td></tr>\n";
  147.         }
  148.         if(match_weather($w1,$w2) && match_weather($w1,$w3) && match_weather($w2,$w3))
  149.         {
  150.             $string .= "<tr><td>$datix</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>$w1n</td></tr>\n";
  151.         }
  152.         if(!match_weather($w1,$w2) && !match_weather($w1,$w3) && match_weather($w2,$w3))
  153.         {
  154.             $string .= "<tr><td>$datix</td><td>-</td><td>-</td><td>$w2n</td><td>$w1n</td><td>-</td><td>-</td></tr>\n";
  155.         }
  156.  
  157.     }
  158.     echo($string);
  159.     echo('</table></body></html>');
  160.    
  161. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement