Advertisement
Guest User

FILTERSCRIPT - Clima Real [FAMILIASAMP.COM]

a guest
Mar 25th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. LEMBRE-SE DE SEPARAR CADA PARTE.
  2.  
  3. ///PARTE PHP///
  4.  
  5. <?php
  6.  
  7. $cidade = $_GET [ 'cidade' ] ;
  8. $url = "http://www.previsaodotempo.net.br/brasil/$cidade/" ;
  9. $dados = file_get_contents ( $url ) ;
  10. $array = explode ( "Tempo agora:", $dados ) ;
  11. $clima = explode ( "\"", $array [ 1 ] ) ;
  12. echo $clima [ 0 ] ;
  13.  
  14. ?>
  15.  
  16. ///PARTE C++///
  17.  
  18. /*
  19. Tempo Real
  20.  
  21. Agradecimentos:
  22. - Lucas 'Lós' Souza,
  23. - Bruno 'ipsBruno' Silva,
  24. Créditos:
  25. - Eduardo 'FreeGells' Knebel
  26. */
  27.  
  28. #include < a_samp >
  29. #include < a_http >
  30.  
  31. #define cidade "sao-paulo"
  32. #define h_atualizar 1
  33.  
  34. forward ReturnWeather ( playerid, returning, data [ ] ) ;
  35. forward SetPWeather ( playerid, Str [ ] ) ;
  36. forward ReturnWeather ( ) ;
  37. forward PickupAllWeather ( ) ;
  38.  
  39. public OnFilterScriptInit ()
  40. {
  41. printf ( " Tempo real da cidade de '%s' carregado com sucesso!", cidade ) ;
  42. SetTimer ( "PickupAllWeather", h_atualizar * 3600000, true ) ;
  43. return 1 ;
  44. }
  45.  
  46. public OnPlayerConnect ( playerid )
  47. {
  48. PickupPTime ( playerid ) ;
  49. return 1 ;
  50. }
  51.  
  52. public ReturnWeather ( playerid, returning, data [ ] )
  53. {
  54. if ( returning == 200 )
  55. {
  56. new
  57. Str [ 128 ] ;
  58.  
  59. data [ strfind ( data, "<!-- Hosting24 Analytics Code -->" ) ] = 0 ;
  60. format ( Str, 128, "%s", data ) ;
  61. SetPWeather ( playerid, Str ) ;
  62. }
  63. return 1 ;
  64. }
  65.  
  66. public SetPWeather ( playerid, Str [ ] )
  67. {
  68. if ( strfind ( Str, "Céu limpo / Sol", true ) != -1 )
  69. return SetPlayerWeather ( playerid, 1 ) ;
  70.  
  71. if ( strfind ( Str, "Parcialmente nublado", true ) != -1 )
  72. return SetPlayerWeather ( playerid, 20 ) ;
  73.  
  74. if ( strfind ( Str, "Neblina", true ) != -1 || strfind ( Str, "Nevoeiro", true ) != -1 )
  75. return SetPlayerWeather ( playerid, 32 ) ;
  76.  
  77. if ( strfind ( Str, "Chuva forte", true) != -1 || strfind ( Str, "Chuva moderada ou forte", true ) != -1 )
  78. return SetPlayerWeather ( playerid, 16 ) ;
  79.  
  80. if ( strfind ( Str, "Chuva moderada", true) != -1 || strfind ( Str, "Chuva leve", true ) != -1 || strfind ( Str, "Chuva nas proximidades", true ) != -1 ||
  81. strfind ( Str, "Garoa leve", true ) != -1 )
  82. return SetPlayerWeather ( playerid, 8 ) ;
  83. return 1 ;
  84. }
  85.  
  86. public PickupAllWeather ( )
  87. {
  88. new
  89. Str [ 256 ] ;
  90.  
  91. format ( Str, 256, "freegellsh.host22.com/weather.php?cidade=%s", cidade ) ;
  92. for ( new i = 0 ; i < GetMaxPlayers ( ) ; i++ )
  93. {
  94. HTTP ( i, HTTP_GET, Str, "\0", "ReturnWeather" ) ;
  95. }
  96. return 1 ;
  97.  
  98. }
  99.  
  100. PickupPTime ( playerid )
  101. {
  102. new
  103. Str [ 256 ] ;
  104.  
  105. format ( Str, 256, "freegellsh.host22.com/weather.php?cidade=%s", cidade ) ;
  106. HTTP ( playerid, HTTP_GET, Str, "\0", "ReturnWeather" ) ;
  107. return 1 ;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement