[Ajuda] Horas
#6

Quote:
Originally Posted by rannyere
Посмотреть сообщение
O horбrio(horбrio de brasilia) no hoste esta correto, jб te falei isso, sua gambiara que nгo esta funcionando.
=D
Adoro gambiarras

Transformei o impossнvel do possнvel!


Primeiramente, hospede este script em uma pбgina qualquer:
PHP код:
<?php
    date_default_timezone_set
("America/Sao_Paulo");
    
    
$getDate     =  Date('d:m:Y:H:i:s');
    
    if(isset(
$_GET['getDate'])){
        echo 
$getDate;
    }
?>

LEMBRE-SE, defina o "EXTERNAL_PAGE" para o url da pбgina hospedada.


FilterScript de exemplo:
pawn Код:
#include a_samp
#include a_http

#define CallBack::%0(%1)        %0(%1); public %0(%1)
#define EXTERNAL_PAGE           "localhost/date.php?getDate"

new
    Hora,           Dia,
    Minuto,         Mes,
    Segundo,        Ano
;

public OnFilterScriptInit(){

    // Para iniciar o processo da data:
    sDate();
    return true;
}


stock sDate(){

    static
        Saida[50]
    ;
    HTTP(0, HTTP_GET, EXTERNAL_PAGE, Saida, "OnRequestDate");
    return 1;
}



CallBack::OnRequestDate(index, response_code, data[]){
    new Saida[6][30];
    explode(data, Saida, ":");
   
    Dia     = strval(Saida[0]);
    Mes     = strval(Saida[1]);
    Ano     = strval(Saida[2]);
   
    Hora    = strval(Saida[3]);
    Minuto  = strval(Saida[4]);
    Segundo = strval(Saida[5]);
   
    printf("Agora sгo: Dia: %02d:%02d:%02d - Data: %02d/%02d/%02d", Hora, Minuto, Segundo, Dia, Mes, Ano);
    return true;
}






stock explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // By Westie's
{
    new iNode, iPointer, iPrevious = -1, iDelimiter = strlen(sDelimiter);
    while(iNode < iVertices)
    {
        iPointer = strfind(sSource, sDelimiter, false, iPointer);
        if(iPointer == -1)
        {
            strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
            break;
        }
        else
        {
            strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
        }
        iPrevious = (iPointer += iDelimiter);
        ++iNode;
    }
    return iPrevious;
}

Mais afinal, oque o script faz ?
Ele pega a hora/data REAL pela internet.
Reply


Messages In This Thread
Horas - by s4kuL - 02.11.2012, 16:01
Re: Horas - by zSuYaNw - 02.11.2012, 16:08
Re: Horas - by s4kuL - 02.11.2012, 16:20
Re: Horas - by rannyere - 02.11.2012, 16:31
Re: Horas - by MatheusAlcapone - 02.11.2012, 17:22
Re: Horas - by zSuYaNw - 02.11.2012, 17:57
Re: Horas - by Maklister - 02.11.2012, 18:21
Re: Horas - by s4kuL - 02.11.2012, 18:22
Re: Horas - by Maklister - 02.11.2012, 18:25
Re: Horas - by rannyere - 02.11.2012, 18:28

Forum Jump:


Users browsing this thread: 1 Guest(s)