SSGamers - 12 Anos online por você.

#SSGamers - A Comunidade que mais crescer no brasil!

Participe do fórum, é rápido e fácil

SSGamers - 12 Anos online por você.

#SSGamers - A Comunidade que mais crescer no brasil!

SSGamers - 12 Anos online por você.

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Chegou o novo tema 6.5.5 - SSGamers - Servidores online de qualidade - Aproveite e entre para nossa comunidade, inscreva-se já! - Ouça nossa web radio - Veja nossas novidades - Participe dos nossos setores de jogos online - Parcerias aberta fale já com um administrador.

4 participantes

    $$$Sistema AFK$$$BY:GustavoAlves

    [Scripter]GustavoAlves
    [Scripter]GustavoAlves
    --> Postador Iniciante
    --> Postador Iniciante


    Celular : 5158415484
    Mensagens : 9
    Moedas : 2834
    Data de inscrição : 19/07/2016

    include - $$$Sistema AFK$$$BY:GustavoAlves Empty $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por [Scripter]GustavoAlves Qua 20 Jul 2016 - 8:47

    Comandos
    /afk > fica AFK
    /voltar > volta
    /ausentes > mostra quem está AFK

    Código
    Code:
    /*
    Sistema AFK com Auto-Kick

    Feito por [XPG]MarlonCS
    Skype: marloncs_22
    */

    //includes
    #include
    #include

    // defines
    #define cinza 0xBEBEBEFF
    #define laranja 0xFFA500FF
    #define verde_claro 0x00FF00FF
    #define vermelho 0xFF0000FF

    // forwards
    forward ChecarAfk(playerid);
    forward AtualizarAfk(playerid);
    forward ChecarPosicao(playerid,Float:afkX,Float:afkY,Float:afkZ);

    // news
    new
    bool:AFKCMD[MAX_PLAYERS],
    AfkCount[MAX_PLAYERS],
    Text:afk[MAX_PLAYERS],
    timeafk[MAX_PLAYERS],
    Float:Position[3],
    AFK[MAX_PLAYERS],
    string[256]
    ;

    public OnFilterScriptInit()
    {
    SetTimer("ChecarPosicao", 600000, true); // Se o player ficar parado por 10 minutos, ele é tido como AFK
    SetTimer("ChecarAfk", 1000, true); // De um em um segundo chega o tempo do player AFK, caso ele esteja 10 minutos, ele é kickado
    print("\nSisteminha AFK carregado *.* -------");
    print("----------------------by [XPG]MarlonCS\n");
    return 1;
    }

    public OnFilterScriptExit()
    {
    return 1;
    }

    public OnPlayerConnect(playerid)
    {
    CriarTextDraw(playerid);
    return 1;
    }

    public OnPlayerDisconnect(playerid, reason)
    {
    if(AFKCMD[playerid]==true) // Se o player sair enquanto tiver AFK antes de usar /voltar
    {
    AFK[playerid]=0;
    AFKCMD[playerid]=false;
    }
    return 1;
    }

    CMD:afk(playerid, params[])
    {
    if(AFKCMD[playerid] == true) { SendClientMessage(playerid, cinza, "[SERVER] Você já está ausente!"); }
    AFK[playerid]=1;
    AFKCMD[playerid]=true;
    TogglePlayerControllable(playerid,0);
    TextDrawShowForPlayer(playerid,afk[playerid]);
    timeafk[playerid] = SetTimer("AtualizarAfk", 60000, true);
    format(string, sizeof(string), "[SERVER] %s está ausente. ( /afk )", pnome(playerid));
    SendClientMessageToAll(laranja, string);
    return 1;
    }

    CMD:voltar(playerid, params[])
    {
    if(AFKCMD[playerid] == false) { SendClientMessage(playerid, cinza, "[SERVER] Você não está ausente!"); }
    AFK[playerid]=0;
    AFKCMD[playerid]=false;
    TogglePlayerControllable(playerid,1);
    TextDrawHideForPlayer(playerid,afk[playerid]);
    KillTimer(timeafk[playerid]);
    format(string, sizeof(string), "[SERVER] %s voltou ao jogo. ( /voltar )", pnome(playerid));
    SendClientMessageToAll(laranja, string);
    return 1;
    }

    CMD:ausentes(playerid, params[])
    {
    new arm[500];
    new str[500];
    new Nome[24];
    new count;
    for(new i=0;i if(IsPlayerConnected(i)) {
    if(AFK[i] > 0) {
    count++;
    GetPlayerName(i, Nome, sizeof(Nome));
    format(str, sizeof(str),"{FFFFFF}Nome: {FFA500}%s {FFFFFF}[%i]\n", Nome, i);
    strcat(arm, str);
    }
    }
    }
    if(count<=0)return ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "===== {FFA500}Ausentes{FFFFFF} ======", "{00FF00}Nenhum player ausente", "OK", "");
    if(count>0)ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "===== {FFA500}Ausentes{FFFFFF} ======", arm, "OK", "");
    return 1;
    }

    public OnPlayerUpdate(playerid)
    {
    GetPlayerPos(playerid, Position[0], Position[1], Position[2]); // Getar posição
    if(AFK[playerid] == 1 && AfkCount[playerid] > 0 && AFKCMD[playerid]==false) // Se o player se mover
    {
    AfkCount[playerid] = 0;
    AFK[playerid]=0;
    KillTimer(timeafk[playerid]);
    }
    return 1;
    }

    stock CriarTextDraw(playerid)
    {
    afk[playerid] = TextDrawCreate(260.000000,222.000000,"~r~AFK ~w~( sair: ~g~/voltar~w~ )");
    TextDrawSetOutline(afk[playerid], 1);
    TextDrawFont(afk[playerid], 2);
    TextDrawSetProportional(afk[playerid], true);
    TextDrawAlignment(afk[playerid], 1);
    TextDrawLetterSize(afk[playerid], 0.4, 3.0);
    TextDrawSetShadow(afk[playerid], 1);
    return 1;
    }
    public AtualizarAfk(playerid)
    {
    AfkCount[playerid]++; // De um em um minuto soma mais 1
    return 1;
    }
    public ChecarPosicao(playerid,Float:afkX,Float:afkY,Float:afkZ) // Checar se o player está parado
    {
    GetPlayerPos(playerid,afkX,afkY,afkZ);
    if (Position[0] == afkX && Position[1] == afkY && Position[2] == afkZ)
    {
    AFK[playerid]=1;
    timeafk[playerid] = SetTimer("AtualizarAfk", 60000, true);
    }
    return 1;
    }
    public ChecarAfk(playerid)
    {
    if(AFK[playerid]==1 && AfkCount[playerid] > 10) { // Verifica se o player está afk por 10 minutos
    SendClientMessage(playerid, vermelho, "[SERVER] Você foi kickado por estar AFK por muito tempo!");
    Kick(playerid);
    format(string, sizeof string, "[SERVER] %s foi kickado por estar AFK por 10 minutos.", pnome(playerid));
    SendClientMessageToAll(vermelho, string);
    }
    return 1;
    }
    stock pnome(playerid)
    {
    new nome[32];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
    }

    OPS:SE DE ALGUM ERRO AO COMPILAR FALO NO MEU SKYPE:Retirado
    avatar
    -
    SS - Membro de honra
    SS - Membro de honra


    Celular : -
    Mensagens : 2172
    Moedas : 7355
    Data de inscrição : 12/10/2015
    Idade : 73

    include - $$$Sistema AFK$$$BY:GustavoAlves Empty Re: $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por - Qui 21 Jul 2016 - 14:57

    @Autor Punido por todos os tópicos em que postou contato.
    @Todos os contatos em tópicos foram retirados.
    AlanR
    AlanR
    --> Postador Iniciante
    --> Postador Iniciante


    Celular : 74988390073
    Mensagens : 102
    Moedas : 3253
    Data de inscrição : 29/11/2015
    Idade : 25

    include - $$$Sistema AFK$$$BY:GustavoAlves Empty Re: $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por AlanR Dom 24 Jul 2016 - 18:41

    Você bem que podia otimizar e organizar seus codes, porque além desse está mau feito, ele tem "define" que não estão sendo utilizadas, ou seja a cor "verde_claro"...



    Faço scripts de samp por encomenda. Entra em contato PM ou Discord!

    Discord: AlanR#6450 (Ativo)

    TSVR - Brasil
    Brasil Curtição Virtual
    IP: 177.54.146.254:7777
    Anonymous
    Convidado
    Convidado


    include - $$$Sistema AFK$$$BY:GustavoAlves Empty Re: $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por Convidado Ter 23 Out 2018 - 2:07

    puro ctrt v + c de outras gm....
    Stremmer_Scripter#0961
    Stremmer_Scripter#0961
    --> Postador Fanático
    --> Postador Fanático


    Celular : 17981120325
    Mensagens : 681
    Moedas : 2966
    Data de inscrição : 19/10/2019
    Idade : 28

    include - $$$Sistema AFK$$$BY:GustavoAlves Empty Re: $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por Stremmer_Scripter#0961 Dom 2 Jan 2022 - 20:04

    ae cotinua assim vai bem

    Conteúdo patrocinado


    include - $$$Sistema AFK$$$BY:GustavoAlves Empty Re: $$$Sistema AFK$$$BY:GustavoAlves

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Qui 28 Mar 2024 - 21:41