[FilterScript] Anti /an indevido
#1

Bom, como uma coisa que hб muito em servidores RPG/RP й /an indevido onde resulta na puniзгo dos players, resolvi fazer um /anuncio que nгo vai ter isso mais!
Como funciona

• Comandos:
-/an ou /anuncio
-/anunciotodos [on/off] (apenas para administradores logado na Rcon)
-/proibiran [ID] (apenas para administradores logado na Rcon)
-/desproibiran [ID] (apenas para administradores logado na Rcon)
-/permitiran [ID] (apenas para administradores logado na Rcon)
-/negarpermissao [ID] (apenas para administradores logado na rcon)

• Sistema:
Funciona assim, o player digita /an ou /anuncio e aparecerб um Dialog com as opзхes:
-Procura de Org/Gang/Serviзo
-Vendas
-Compras
-Outro

Clicando em Procura de Org/Gang/Serviзo aparecerб outro Dialog com as seguintes opзхes:
-Procuro Org
-Procuro Gang
-Procuro Org ou Gang
-Procuro serviзo de mecanico
-Procuro detetive.

Clicando em Vendas aparecerб um dialog com as seguintes opзхes:
-Vendo carro
-Vendo casa
-Vendo drogas
-Vendo armas

Clicando em Compras aparecerб um dialog com as seguintes opзхes:
-Compro casa
-Compro carro
-Compro armas
-Compro drogas


E a opзгo Outro? Simples, clicando nesse vocк pode digitar seu prуprio anъncio.
Aн vocк pergunta: Pra que esse FS entгo, se eles podem anunciar o que querem do mesmo jeito?
Resposta: Esses anъncios nгo serгo enviados logo em seguida, serгo mandados para os administradores para que possam ser "aprovados", se um admin aprovar ele й enviado.

E se for uma data especial, vou ter que permitir o envio para todos players?
Resposta: Nгo, por isso foi criado o comando /anunciotodos que libera o envio pra todos!

E se tiver algum player que eu nгo quero que envie?
Resposta: Simples, /proibiran.

Crйditos:
Aninhaah (humildadeforever)
Vitor (me ajudou com os testes)


Pastebin: http://pastebin.com/8RXpGrQs
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#define DIALOG_ANUNCIOS 1
#define DIALOG_ANUNCIO_PROCURA 2
#define DIALOG_ANUNCIO_VENDAS 3
#define DIALOG_ANUNCIO_COMPRAS 4
#define DIALOG_PERGUNTAR_ANUNCIO 5
#define DIALOG_OUTRO_ANUNCIO 6
#define DIALOG_ANUNCIO_LIBERADO 7

new bool:PermissaoTodos = false;
new bool:Proibido[MAX_PLAYERS] = false;
new bool:PermissaoEnviada[MAX_PLAYERS] = false;
new Anuncio[MAX_PLAYERS][60];

new giveplayerid;
CMD:an(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_ANUNCIOS, DIALOG_STYLE_LIST, "[NomeSv] - Anuncios. Selecione uma categoria","Procura de Org/Gang/Serviзo\nVendas\nCompras\nOutro","Continuar","Cancelar");
    return 1;
}
CMD:anuncio(playerid, params[])
{
    cmd_an(playerid, params);
    return 1;
}

CMD:anunciotodos(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Vocк precisa estar logado na rcon para usar o comando.");
    new offouon[3];
    if(sscanf(params, "s", offouon)) return SendClientMessage(playerid, -1,"Use: /anunciotodos off/on");
    if(strcmp(params,"off", true) == 0)
    {
        if(PermissaoTodos == false) return SendClientMessage(playerid,-1,"Permissгo para todos jб estб off");
        PermissaoTodos = false;
        new string[75];
        format(string,sizeof(string),"{00FFFF}%s {F8F8FF}desativou o OA (Outro anъncio) para todos", PlayerName(playerid));
        SendClientMessageToAll(-1,string);
        print(string);
    }
    else if(strcmp(params,"on", true) == 0)
    {
        if(PermissaoTodos == true) return SendClientMessage(playerid,-1,"Permissгo para todos jб estб On");
        PermissaoTodos = true;
        new string[75];
        format(string,sizeof(string),"{00FFFF}%s{F8F8FF} ativou o OA (Outro anъncio) para todos!", PlayerName(playerid));
        SendClientMessageToAll(-1,string);
        print(string);
    }
    else { SendClientMessage(playerid, -1,"Use: /anunciotodos [off/on]"); }
    return 1;
}

CMD:proibiran(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Voce nao pode usar esse comando.");
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid,-1,"Use: /proibiran [ID]");
    if(Proibido[giveplayerid] == true) return SendClientMessage(playerid,-1,"Jogador jб estб proibido");
    Proibido[giveplayerid] = true;
    new string[106];
    format(string,sizeof(string),"{00FFFF}%s {F8F8FF}proibiu {00FFFF}%s {F8F8FF}de usar a categoria Outro do /an", PlayerName(playerid), PlayerName(giveplayerid));
    if(playerid != giveplayerid) return SendClientMessage(playerid,-1,string);//caso o player usa o comando com ele mesmo nao vai mandar 2 vzs a msg
    SendClientMessage(giveplayerid,-1,string);
    print(string);
    return 1;
}
CMD:desproibiran(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Voce nao pode usar esse comando.");
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid,-1,"Use: /desproibiran [ID]");
    if(Proibido[giveplayerid] == false) return SendClientMessage(playerid,-1,"Jogador nгo estб proibido");
    Proibido[giveplayerid] = false;
    new string[86];
    format(string,sizeof(string),"{00FFFF}%s {F8F8FF}desproibiu {00FFFF}%s {F8F8FF}de usar a categoria Outro do /an", PlayerName(playerid), PlayerName(giveplayerid));
    SendClientMessage(playerid,-1,string);
    SendClientMessage(giveplayerid,-1,string);
    print(string);
    return 1;
}
CMD:permitiran(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Voce nao pode usar esse comando.");
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid,-1,"Use: /permitiran [ID]");
    if(PermissaoEnviada[giveplayerid] == false) return SendClientMessage(playerid,-1,"Nenhuma solicitaзгo de anuncio pendente para esse jogador");
    PermissaoEnviada[giveplayerid] = false;
    new string[130];
    format(string,sizeof(string),"{00FFFF}%s{F8F8FF} permitiu {00FFFF}%s{F8F8FF} enviar seu anuncio.", PlayerName(playerid),PlayerName(giveplayerid));
    if(!IsPlayerAdmin(giveplayerid)) return SendClientMessage(giveplayerid,-1,string);//pq se ele for adm vai enviar tambem, ai vai ficar 2 avisos
    print(string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendClientMessage(i, -1,string);
    }
    format(string,sizeof(string),"Anuncio de {00FFFF}%s{F8F8FF}: {00FFFF}%s", PlayerName(giveplayerid), Anuncio[giveplayerid]);
    if(!IsPlayerAdmin(giveplayerid)) return SendClientMessage(giveplayerid, -1, string);
    print(string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendClientMessage(i, -1,string);
    }
    format(string,sizeof(string),"{7CFC00}[Anuncio] %s. Contato: {00FF00}%s.", Anuncio[giveplayerid], PlayerName(giveplayerid));
    SendClientMessageToAll(-1, string);
    GivePlayerMoney(giveplayerid, -100);
    GameTextForPlayer(giveplayerid, "~g~R$-100", 1000, 1);
    return 1;
}
CMD:negarpermissao(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Voce nao pode usar esse comando.");
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid,-1,"Use: /negarpermissao [ID]");
    if(PermissaoEnviada[giveplayerid] == false) return SendClientMessage(playerid,-1,"Nenhuma solicitaзгo de anuncio pendente para esse jogador");
    PermissaoEnviada[giveplayerid] = false;
    new string[140];
    format(string,sizeof(string),"%s negou a permissao para %s enviar seu anuncio.", PlayerName(playerid), PlayerName(giveplayerid));
    SendClientMessage(giveplayerid,-1,string);
    print(string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendClientMessage(i, -1,string);
    }
    format(string,sizeof(string),"Anuncio de %s: %s", PlayerName(giveplayerid),Anuncio[giveplayerid]);
    SendClientMessage(giveplayerid,-1,string);
    print(string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendClientMessage(i, -1,string);
    }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ANUNCIOS)
    {
        if(!response) return SendClientMessage(playerid,-1,"Vocк cancelou o envio do anъncio.");
        if(listitem == 0)
        {
            ShowPlayerDialog(playerid, DIALOG_ANUNCIO_PROCURA, DIALOG_STYLE_LIST,"[NomeSv] - Selecione um anъncio","Procuro Org\nProcuro Gang\nProcuro Org ou Gang\nProcuro serviзo de mecanico\nProcuro Detetive","Anunciar","Cancelar");
        }
        else if(listitem == 1)
        {
            ShowPlayerDialog(playerid, DIALOG_ANUNCIO_VENDAS,DIALOG_STYLE_LIST,"[NomeSv] - Selecione um anъncio","Vendo carro\nVendo casa\nVendo drogas\nVendo armas","Anunciar","Cancelar");
        }
        else if(listitem == 2)
        {
            ShowPlayerDialog(playerid, DIALOG_ANUNCIO_COMPRAS, DIALOG_STYLE_LIST,"[NomeSv] - Selecione um anъncio","Compro casa\nCompro carro\nCompro armas\nCompro drogas","Anunciar","Cancelar");
        }
        else if(listitem == 3)
        {
            if(PermissaoTodos == true && Proibido[playerid] == false) return ShowPlayerDialog(playerid, DIALOG_ANUNCIO_LIBERADO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviando anuncio","Digite seu anъncio","Enviar","Cancelar");
            if(Proibido[playerid] == true) return SendClientMessage(playerid,-1,"Vocк estб proibido de enviar anuncios nessa categoria (Outro)");
            if(PermissaoEnviada[playerid] == true) return  SendClientMessage(playerid,-1,"Vocк jб tem uma solicitaзгo de anuncio pendente, espera a decisгo dos admins");
            else return ShowPlayerDialog(playerid, DIALOG_PERGUNTAR_ANUNCIO,DIALOG_STYLE_MSGBOX,"[NomeSv] - Outro anъncio","Para evitar o anuncio indevido, vocк pode digitar seu anъncio e esperar que um administrador level 5+ permita o envio","Continuar","Cancelar");
        }
        return 1;
    }
    if(dialogid == DIALOG_ANUNCIO_PROCURA)
    {
        if(response)
        {
            new antext[30],string[96];
            if(listitem == 0)
            {
                antext = "Procuro Org";
            }
            else if(listitem == 1)
            {
                antext = "Procuro Gang";
            }
            else if(listitem == 2)
            {
                antext = "Procuro Org ou Gang";
            }
            else if(listitem == 3)
            {
                antext = "Procuro serviзo de mecвnico";
            }
            else if(listitem == 4)
            {
                antext = "Procuro Detetive";
            }
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,-1,"Vocк precisa de R$ 100 para anunciar");
            format(string,sizeof(string),"{7CFC00}[Anuncio] %s. Contato: {00FF00}%s.", antext, PlayerName(playerid));
            SendClientMessageToAll(-1, string);
            GivePlayerMoney(playerid, -100);
            GameTextForPlayer(playerid, "~g~R$-100", 1000, 1);
        }
        else if(!response)
        {
            SendClientMessage(playerid,-1,"Vocк cancelou o envio do anъncio");
        }
        return 1;
    }
    if(dialogid == DIALOG_ANUNCIO_VENDAS)
    {
        if(response)
        {
            new antext[30],string[96];
            if(listitem == 0)
            {
                antext = "Vendo carro";
            }
            else if(listitem == 1)
            {
                antext = "Vendo casa";
            }
            else if(listitem == 2)
            {
                antext = "Vendo drogas";
            }
            else if(listitem == 3)
            {
                antext = "Vendo armas";
            }
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,-1,"Vocк precisa de R$ 100 para anunciar");
            format(string,sizeof(string),"{7CFC00}[Anuncio] %s. Contato: {00FF00}%s.", antext, PlayerName(playerid));
            SendClientMessageToAll(-1, string);
            GivePlayerMoney(playerid, -100);
            GameTextForPlayer(playerid, "~g~R$-100", 1000, 1);
        }
        else if(!response)
        {
            SendClientMessage(playerid,-1,"Vocк cancelou o envio do anъncio");
        }
        return 1;
    }
    if(dialogid == DIALOG_ANUNCIO_COMPRAS)
    {
        if(response)
        {
            new antext[30],string[96];
            if(listitem == 0)
            {
                antext = "Compro casa";
            }
            else if(listitem == 1)
            {
                antext = "Compro carro";
            }
            else if(listitem == 2)
            {
                antext = "Compro armas";
            }
            else if(listitem == 3)
            {
                antext = "Compro drogas";
            }
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,-1,"Vocк precisa de R$ 100 para anunciar");
            format(string,sizeof(string),"{7CFC00}[Anuncio] %s. Contato: {00FF00}%s.", antext, PlayerName(playerid));
            SendClientMessageToAll(-1, string);
            GivePlayerMoney(playerid, -100);
            GameTextForPlayer(playerid, "~g~R$-100", 1000, 1);
        }
        else if(!response)
        {
            SendClientMessage(playerid,-1,"Vocк cancelou o envio do anъncio");
        }
        return 1;
    }
    if(dialogid == DIALOG_PERGUNTAR_ANUNCIO)
    {
        if(!response) return SendClientMessage(playerid,-1,"Vocк cancelou o envio do anъncio");
        ShowPlayerDialog(playerid, DIALOG_OUTRO_ANUNCIO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviando anuncio","Digite seu anъncio","Solicitar","Cancelar");
        return 1;
    }
    if(dialogid == DIALOG_ANUNCIO_LIBERADO)
    {
        if(!response) return SendClientMessage(playerid, -1, "Vocк cancelou o envio do anuncio");
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_ANUNCIO_LIBERADO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviar anuncio","Digite o anuncio","Enviar","Cancelar");
        if(strlen(inputtext) > 60) return ShowPlayerDialog(playerid, DIALOG_ANUNCIO_LIBERADO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviar anuncio","Simplifique seu anuncio (atй 60 caracteres)","Enviar","Cancelar");
        if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,-1,"Vocк precisa de R$ 100 para anunciar");
        new string[110];
        format(string,sizeof(string),"{7CFC00}[Anuncio] %s. Contato: {00FF00}%s.", inputtext, PlayerName(playerid));
        SendClientMessageToAll(-1, string);
        GivePlayerMoney(playerid, -100);
        GameTextForPlayer(playerid, "~g~R$-100", 1000, 1);
        return 1;
    }
    if(dialogid == DIALOG_OUTRO_ANUNCIO)
    {
        if(!response) return SendClientMessage(playerid,0x00FF3DFF,"Vocк cancelou o envio do anuncio");
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_OUTRO_ANUNCIO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviar anuncio","Digite o anuncio","Enviar","Cancelar");
        if(strlen(inputtext) > 60) return ShowPlayerDialog(playerid, DIALOG_OUTRO_ANUNCIO, DIALOG_STYLE_INPUT,"[NomeSv] - Enviar anuncio","Simplifique seu anuncio (atй 60 caracteres)","Enviar","Cancelar");
        if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid,0x00FF3DFF,"Vocк precisa de R$ 100 para anunciar");
        //NSA = Nova Solicitaзгo de Anuncio
        new string[100];
        format(string,sizeof(string),"[NSA]Nome:{00FFFF}%s{F8F8FF}.Anuncio:{00FFFF}%s",PlayerName(playerid), inputtext);
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid,0xFFFF00FF,"|================== Nova Solicitaзгo de Anuncio ================|");
            SendClientMessage(playerid,-1,string);
            SendClientMessage(playerid,0xFFFF00FF,"|===============================================================|");
        }
        new count = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i,0xFFFF00FF,"|================== Nova Solicitaзгo de Anuncio ================|");
                SendClientMessage(i,-1,string);
                SendClientMessage(i,0xFFFF00FF,"|===============================================================|");
                SendClientMessage(i, -1,"Use: /permitiran [ID]");
                count ++;
            }
        }
        if(count == 0) return SendClientMessage(playerid, 0x00FF3DFF," Nгo hб nenhum administrador online :/ Seu anuncio nгo ficarб pendente");
        else if(count >= 1)
        {
            PermissaoEnviada[playerid] = true;
            new an[60];
            strcat(an,inputtext);
            Anuncio[playerid] = an;
            return 1;
        }
        return 1;
    }
    return 1;
}

stock PlayerName(playerid)
{
    new Name[MAX_PLAYERS];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}

Imagens:
http://imageshack.us/photo/my-images/32/samp002fl.png
http://imageshack.us/photo/my-images/526/samp003erw.png
http://imageshack.us/photo/my-images/856/samp004vv.png
http://imageshack.us/photo/my-images/651/samp006lc.png
http://imageshack.us/photo/my-images/801/samp007cg.png
http://imageshack.us/photo/my-images/38/samp008bz.png
http://imageshack.us/photo/my-images/802/samp009fw.png
http://imageshack.us/photo/my-images/24/samp010jv.png
http://imageshack.us/photo/my-images/842/samp011ht.png
http://imageshack.us/photo/my-images/7/samp012xs.png
http://imageshack.us/photo/my-images/841/samp013dtc.png
Reply
#2

Muito bom Gostei
Reply
#3

Simples, porйm ъtil. Gostei cara
Reply
#4

Quote:
Originally Posted by Caio_Freeze
Посмотреть сообщение
Muito bom Gostei

ela nem postou ainda :S
Reply
#5

Pronto, tб ae
Reply
#6

Muito Bom!
Reply
#7

Se um servidor tiver sistema de anti-money hack isso vai bugar nao vai?
Reply
#8

parabйns carinha.
Reply
#9

Уtimo trabalho, Ana.

A pessoa que for usar isso, ser for novato, vai ter uma dorzinha de cabeзa, por que por 90% dos servidores serem Brasil Magic Games(BMG) editado, a maioria jб tem o comando /AN, ou /ANUNCIO, o que acontece й que darб conflito.
Reply
#10

Quote:
Originally Posted by [BPW]Wesley
Посмотреть сообщение
Simples, porйm ъtil. Gostei cara
Quote:
Originally Posted by GReeN_WOoD
Посмотреть сообщение
parabйns carinha.
Ela й Mulher '-'

@ONTOPIC

Parabйns, nгo testei mas pela descriзгo jб da para saber que й bastante ъtil!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)