[AJUDA] SendRconCommand
#1

Tipo eu estou com um comando aki de votaзao
pawn Код:
new string[256];
    if(!strcmp(cmdtext, "/votacao", true,5))
    {
            if(!votacao[iniciada])
            {
                if(!strlen(cmdtext[6]))
                    return SendClientMessage(playerid,0x0050F6AA, "Use: /votacao [texto]");
                format(string, sizeof string, " Nova Votaзгo: %s?", cmdtext[6]);
                SendClientMessageToAll(0x81F628AA, string);
                SendClientMessageToAll(0xFF6600AA," ");
                SendClientMessageToAll(0x0050F6AA, " /sim - Para concordar.");
                SendClientMessageToAll(0x0050F6AA, " /nao - Para desconcordar.");
                votacao[iniciada] = true;
                votacao[sim] = 0;
                votacao[nao] = 0;
                GameTextForAll("",6000,3);
                for(new i; i <MAX_PLAYERS; i++)
                {
                    votou[i] = false;
                }
            } else {
                SendClientMessage(playerid,0xFF9900AA," Jб existe uma votaзгo em andamento!");
        }
        SendRconCommand();
        return 1;
    }
    if(!strcmp(cmdtext, "/sim", true))
    {
        if(votacao[iniciada] && !votou[playerid])
        {
            SendClientMessage(playerid,0xFFFF00AA, " Seu voto foi enviado com sucesso!");
            votacao[sim]++;
            votacao[total]++;
            votou[playerid] = true;
            return 1;
        }
        return 0;
    }
    if(!strcmp(cmdtext, "/nao", true))
    {
        if(votacao[iniciada] && !votou[playerid])
        {
            SendClientMessage(playerid,0xFFFF00AA, " Seu voto foi enviado com sucesso!");
            votacao[nao]++;
            votacao[total]++;
            votou[playerid] = true;
            return 1;
        }
        return 0;
    }
    if(!strcmp(cmdtext, "/fecharvotacao", true))
    {
            if(votacao[iniciada])
            {
                SendClientMessageToAll(0xFF9900AA, " Votacгo encerrada! ");
                format(string, sizeof string, " %d jogadores concordaram com a pergunta.", votacao[sim]);
                SendClientMessageToAll(0x0050F6AA,string);
                format(string, sizeof string, " %d jogadores discordaram com a pergunta.", votacao[nao]);
                SendClientMessageToAll(0x0050F6AA, string);
                format(string, sizeof string, " Esta votaзгo teve %d votos!",votacao[total]);
                SendClientMessageToAll(0xFFFFFFFF, string);
                if(votacao[sim] == votacao[nao])
                {
                    SendClientMessageToAll(0xFF9900AA, " Houve um empate!");
                } else if(votacao[sim] > votacao[nao])
                {
                    SendClientMessageToAll(0x0050F6AA, " A maioria CONCORDA com a pergunta.");
                } else if(votacao[sim] < votacao[nao])
                {
                    SendClientMessageToAll(0x0050F6AA, " A maioria DISCORDA com a pergunta.");
                }
                GameTextForAll("",6000,3);
                votacao[iniciada] = false;
                votacao[sim] = 0;
                votacao[nao] = 0;
                votacao[total] = 0;
                for(new i; i <MAX_PLAYERS; i++)
                {
                    votou[i] = false;
                }
            } else {
                SendClientMessage(playerid,0xFFFF00AA, "Nenhuma votaзгo foi criada!");
            }
        return 1;
        }
eu queria o fechar votacao e o /votacao para colocar como somente admin logado na Rcon q podesse escrever este comando ^^
Reply
#2

pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "[ERRO]: Vocк Nгo й Admin RCON");
^^
Reply
#3

pawn Код:
if(IsPlayerAdmin(playerid))
Reply
#4

Coloque esse code no comando /fecharvotacao if(IsPlayerAdmin(playerid))
, quando fizer isso somente administradores logados na RCON poderгo encerrar a votaзгo!
Reply
#5

pawn Код:
if(!IsPlayerAdmin(playerid))
{
       SendClientMessage(playerid,-1,"Você não está autorizado á usar este comando");
       return 1;
}
Reply
#6

pawn Код:
new string[256];
    if(!strcmp(cmdtext, "/votacao", true,5))
    {
     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo й um admin.");
     {
            if(!votacao[iniciada])
            {
                if(!strlen(cmdtext[6]))
                    return SendClientMessage(playerid,0x0050F6AA, "Use: /votacao [texto]");
                format(string, sizeof string, " Nova Votaзгo: %s?", cmdtext[6]);
                SendClientMessageToAll(0x81F628AA, string);
                SendClientMessageToAll(0xFF6600AA," ");
                SendClientMessageToAll(0x0050F6AA, " /sim - Para concordar.");
                SendClientMessageToAll(0x0050F6AA, " /nao - Para desconcordar.");
                votacao[iniciada] = true;
                votacao[sim] = 0;
                votacao[nao] = 0;
                GameTextForAll("",6000,3);
                for(new i; i <MAX_PLAYERS; i++)
                {
                    votou[i] = false;
                }
            } else {
                SendClientMessage(playerid,0xFF9900AA," Jб existe uma votaзгo em andamento!");
        }
        SendRconCommand();
        return 1;
    }
    if(!strcmp(cmdtext, "/sim", true))
    {
        if(votacao[iniciada] && !votou[playerid])
        {
            SendClientMessage(playerid,0xFFFF00AA, " Seu voto foi enviado com sucesso!");
            votacao[sim]++;
            votacao[total]++;
            votou[playerid] = true;
            return 1;
        }
        return 0;
    }
    if(!strcmp(cmdtext, "/nao", true))
    {
        if(votacao[iniciada] && !votou[playerid])
        {
            SendClientMessage(playerid,0xFFFF00AA, " Seu voto foi enviado com sucesso!");
            votacao[nao]++;
            votacao[total]++;
            votou[playerid] = true;
            return 1;
        }
        return 0;
    }
    if(!strcmp(cmdtext, "/fecharvotacao", true))
    {
            if(votacao[iniciada])
            {
                SendClientMessageToAll(0xFF9900AA, " Votacгo encerrada! ");
                format(string, sizeof string, " %d jogadores concordaram com a pergunta.", votacao[sim]);
                SendClientMessageToAll(0x0050F6AA,string);
                format(string, sizeof string, " %d jogadores discordaram com a pergunta.", votacao[nao]);
                SendClientMessageToAll(0x0050F6AA, string);
                format(string, sizeof string, " Esta votaзгo teve %d votos!",votacao[total]);
                SendClientMessageToAll(0xFFFFFFFF, string);
                if(votacao[sim] == votacao[nao])
                {
                    SendClientMessageToAll(0xFF9900AA, " Houve um empate!");
                } else if(votacao[sim] > votacao[nao])
                {
                    SendClientMessageToAll(0x0050F6AA, " A maioria CONCORDA com a pergunta.");
                } else if(votacao[sim] < votacao[nao])
                {
                    SendClientMessageToAll(0x0050F6AA, " A maioria DISCORDA com a pergunta.");
                }
                GameTextForAll("",6000,3);
                votacao[iniciada] = false;
                votacao[sim] = 0;
                votacao[nao] = 0;
                votacao[total] = 0;
                for(new i; i <MAX_PLAYERS; i++)
                {
                    votou[i] = false;
                }
            } else {
                SendClientMessage(playerid,0xFFFF00AA, "Nenhuma votaзгo foi criada!");
            }
        return 1;
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)