Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LEMBRE-SE DE SEPARAR CADA PARTE.
- ///PARTE PHP///
- <?php
- $cidade = $_GET [ 'cidade' ] ;
- $url = "http://www.previsaodotempo.net.br/brasil/$cidade/" ;
- $dados = file_get_contents ( $url ) ;
- $array = explode ( "Tempo agora:", $dados ) ;
- $clima = explode ( "\"", $array [ 1 ] ) ;
- echo $clima [ 0 ] ;
- ?>
- ///PARTE C++///
- /*
- Tempo Real
- Agradecimentos:
- - Lucas 'Lós' Souza,
- - Bruno 'ipsBruno' Silva,
- Créditos:
- - Eduardo 'FreeGells' Knebel
- */
- #include < a_samp >
- #include < a_http >
- #define cidade "sao-paulo"
- #define h_atualizar 1
- forward ReturnWeather ( playerid, returning, data [ ] ) ;
- forward SetPWeather ( playerid, Str [ ] ) ;
- forward ReturnWeather ( ) ;
- forward PickupAllWeather ( ) ;
- public OnFilterScriptInit ()
- {
- printf ( " Tempo real da cidade de '%s' carregado com sucesso!", cidade ) ;
- SetTimer ( "PickupAllWeather", h_atualizar * 3600000, true ) ;
- return 1 ;
- }
- public OnPlayerConnect ( playerid )
- {
- PickupPTime ( playerid ) ;
- return 1 ;
- }
- public ReturnWeather ( playerid, returning, data [ ] )
- {
- if ( returning == 200 )
- {
- new
- Str [ 128 ] ;
- data [ strfind ( data, "<!-- Hosting24 Analytics Code -->" ) ] = 0 ;
- format ( Str, 128, "%s", data ) ;
- SetPWeather ( playerid, Str ) ;
- }
- return 1 ;
- }
- public SetPWeather ( playerid, Str [ ] )
- {
- if ( strfind ( Str, "Céu limpo / Sol", true ) != -1 )
- return SetPlayerWeather ( playerid, 1 ) ;
- if ( strfind ( Str, "Parcialmente nublado", true ) != -1 )
- return SetPlayerWeather ( playerid, 20 ) ;
- if ( strfind ( Str, "Neblina", true ) != -1 || strfind ( Str, "Nevoeiro", true ) != -1 )
- return SetPlayerWeather ( playerid, 32 ) ;
- if ( strfind ( Str, "Chuva forte", true) != -1 || strfind ( Str, "Chuva moderada ou forte", true ) != -1 )
- return SetPlayerWeather ( playerid, 16 ) ;
- if ( strfind ( Str, "Chuva moderada", true) != -1 || strfind ( Str, "Chuva leve", true ) != -1 || strfind ( Str, "Chuva nas proximidades", true ) != -1 ||
- strfind ( Str, "Garoa leve", true ) != -1 )
- return SetPlayerWeather ( playerid, 8 ) ;
- return 1 ;
- }
- public PickupAllWeather ( )
- {
- new
- Str [ 256 ] ;
- format ( Str, 256, "freegellsh.host22.com/weather.php?cidade=%s", cidade ) ;
- for ( new i = 0 ; i < GetMaxPlayers ( ) ; i++ )
- {
- HTTP ( i, HTTP_GET, Str, "\0", "ReturnWeather" ) ;
- }
- return 1 ;
- }
- PickupPTime ( playerid )
- {
- new
- Str [ 256 ] ;
- format ( Str, 256, "freegellsh.host22.com/weather.php?cidade=%s", cidade ) ;
- HTTP ( playerid, HTTP_GET, Str, "\0", "ReturnWeather" ) ;
- return 1 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement