[FilterScript] Auto ******* & News System
#1

Auto ******* v1.0
Esse sistema, nada mais, que pega a ultima postagem de algum nome de usuario definido no FS. Ao pegar o Nome do Usuario, ele envia uma mensagem a pagina php, onde ele converte o XML, transformando em um simples texto, Onde depois ira aparecer no Servidor.

Caso a noticia seja a mesma (Atualiza a cada 10 Segundos), ele pega uma mensagem randomica pre-configurada, e coloca no lugar.


Print's:



Sim, continuo nao sendo um bom design


Codigos:


Pawno
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <a_http>

#define NomedaConta "DoDo_GTO"
new ultimostwitt[500];

new Text:*******[3];

new *******Igual[3][500] =
{
    "******* de DoDo_BOT || Frase 1!",
    "******* de DoDo_BOT || Frase 2!",
    "******* de DoDo_BOT || Frase 3!"
};



public OnFilterScriptInit()
{
    print("Testando..");

    SetTimer("Check*******", 10000, true);

    *******[0] = TextDrawCreate(243.000000, 420.000000, "Auto *******");
    TextDrawBackgroundColor(*******[0], -1);
    TextDrawFont(*******[0], 2);
    TextDrawLetterSize(*******[0], 0.479999, 1.100000);
    TextDrawColor(*******[0], 65535);
    TextDrawSetOutline(*******[0], 1);
    TextDrawSetProportional(*******[0], 1);

    *******[1] = TextDrawCreate(2.000000, 435.000000, "_");
    TextDrawBackgroundColor(*******[1], -1);
    TextDrawFont(*******[1], 2);
    TextDrawLetterSize(*******[1], 0.189999, 1.000000);
    TextDrawColor(*******[1], 65535);
    TextDrawSetOutline(*******[1], 1);
    TextDrawSetProportional(*******[1], 1);

    *******[2] = TextDrawCreate(2.000000, 436.000000, "_");
    TextDrawBackgroundColor(*******[2], -1);
    TextDrawFont(*******[2], 2);
    TextDrawLetterSize(*******[2], 0.479999, 1.100000);
    TextDrawColor(*******[2], 65535);
    TextDrawSetOutline(*******[2], 1);
    TextDrawSetProportional(*******[2], 1);
    TextDrawUseBox(*******[2], 1);
    TextDrawBoxColor(*******[2], -16776961);
    TextDrawTextSize(*******[2], 638.000000, 0.000000);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}


public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, *******[0]);
    TextDrawShowForPlayer(playerid, *******[1]);
    TextDrawShowForPlayer(playerid, *******[2]);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
forward Resultado*******(index, response_code, data[]);
public Resultado*******(index, response_code, data[])
{
    new noticia[ 128 ];
    if(strlen(data) == strlen(ultimostwitt))
    {
        new st[500];
        format(st, sizeof(st), "%s", *******Igual[random(sizeof(*******Igual))]);
        format(ultimostwitt, sizeof(ultimostwitt), "%s", st); //Nao Ficar Igual e Nunca Mais Verificar a do ******* '-'
        TextDrawSetString(*******[1], st);
        return 0;
    }
    if(response_code == 200)
    {
        new TempGameText[500];
        TempGameText = DecodificarTexto(data);
        format(noticia, sizeof(noticia), "%s", TempGameText);
        format(ultimostwitt, sizeof(ultimostwitt), "%s", TempGameText);
        TextDrawSetString(*******[1],noticia);
    }
    if(response_code == HTTP_ERROR_CANT_WRITE)
    {
        TextDrawSetString(*******[1], "Nao Conseguiu Ler a Noticia");
    }
    if(response_code == HTTP_ERROR_CONTENT_TOO_BIG)
    {
        TextDrawSetString(*******[1], "Noticia Muito Grande");
    }
    if(response_code == HTTP_ERROR_MALFORMED_RESPONSE)
    {
        TextDrawSetString(*******[1], "Noticia Mal Formulada");
    }
    return 0x01;
}
forward Check*******();
public Check*******()
{
    new link[500];
    format(link, sizeof(link), "gtotorcidas.cz.cc/ola.php?nick=%s", NomedaConta);
    HTTP(INVALID_PLAYER_ID, HTTP_GET, link, "", "Resultado*******");
    return 0x01;
}

forward DecodificarTexto(TextuDecodif[]);
DecodificarTexto(TextuDecodif[])
{
    new resultado[500];
    for(new i=0; i<strlen(TextuDecodif); i++)
    {
        if(TextuDecodif[i] == 'б') resultado[i] = 'a';
        if(TextuDecodif[i] == 'й') resultado[i] = 'e';
        if(TextuDecodif[i] == 'н') resultado[i] = 'i';
        if(TextuDecodif[i] == 'у') resultado[i] = 'o';
        if(TextuDecodif[i] == 'ъ') resultado[i] = 'u';
        if(TextuDecodif[i] == 'а') resultado[i] = 'a';
        if(TextuDecodif[i] == 'и') resultado[i] = 'e';
        if(TextuDecodif[i] == 'м') resultado[i] = 'i';
        if(TextuDecodif[i] == 'т') resultado[i] = 'o';
        if(TextuDecodif[i] == 'щ') resultado[i] = 'u';
        if(TextuDecodif[i] == 'г') resultado[i] = 'a';
        if(TextuDecodif[i] == 'х') resultado[i] = 'o';
        if(TextuDecodif[i] == 'ф') resultado[i] = 'o';
        else resultado[i] = TextuDecodif[i];
    }
    return resultado;
}
PHP (Creditos A: Ryan Barr)
PHP код:
<?php
$username 
$_GET['nick']; 
$prefix "******* de: $username || ";
$feed "http://search.*******.com/search.atom?q=from:" $username "&rpp=1";
function 
parse_feed($feed
{
$stepOne explode("<content type=\"html\">"$feed);
$stepTwo explode("</content>"$stepOne[1]);
$tweet $stepTwo[0];
$tweet str_replace("&lt;""<"$tweet);
$tweet str_replace("&gt;"">"$tweet);
return 
$tweet;
}
$*******Feed file_get_contents($feed);
echo 
stripslashes($prefix) . parse_feed($*******Feed);
?>
Agradecimentos:
Gustavo_Araujo


Link da pagina Ja Hospedada: gtotorcidas.cz.cc/ola.php
Reply


Messages In This Thread
Auto ******* & News System - by GTO.DoDo - 24.01.2013, 23:57
Re: Auto ******* & News System - by ForT - 25.01.2013, 00:07
Re: Auto ******* & News System - by GTO.DoDo - 25.01.2013, 00:34
Re: Auto ******* & News System - by @LucasVinicius - 25.01.2013, 01:10
Re: Auto ******* & News System - by ViniBorn - 25.01.2013, 01:15
Respuesta: Auto ******* & News System - by [NVC]iTrevaS - 25.01.2013, 01:21
Re: Auto ******* & News System - by GTO.DoDo - 25.01.2013, 01:22
Respuesta: Auto ******* & News System - by ipsBruno - 25.01.2013, 01:24
Re: Respuesta: Auto ******* & News System - by GTO.DoDo - 25.01.2013, 01:54
Re: Auto ******* & News System - by zSuYaNw - 25.01.2013, 01:59

Forum Jump:


Users browsing this thread: 2 Guest(s)