[Ajuda] Comando Banir
#1

Problema:

Esta dando erro no comando de banir, sгo estes erros:

Log de Erros:

pawn Код:
C:\Users\Edilson\Downloads\GM\gamemodes\GM.pwn(1130) : error 035: argument type mismatch (argument 3)
C:\Users\Edilson\Downloads\GM\gamemodes\GM.pwn(1131) : error 035: argument type mismatch (argument 3)
C:\Users\Edilson\Downloads\GM\gamemodes\GM.pwn(1132) : error 035: argument type mismatch (argument 3)
C:\Users\Edilson\Downloads\GM\gamemodes\GM.pwn(1133) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Linhas de erro:

pawn Код:
DOF2_SetInt(string,"Admin", Nome);
DOF2_SetInt(string,"Data", Data);
DOF2_SetInt(string,"Hora", Horario);
DOF2_SetInt(string,"Motivo", motivo);
Cуdigo:

pawn Код:
CMD:banir(playerid, params[])
{
    new id, motivo[128], Nome[24], GNome[24], string[200], Ano, Mes, Dia, Hora, Minuto, Segundo, Data[50], Horario[50];
    if(Player[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"Vocк nгo esta autorizado a utilizar este comando!");
    if(sscanf(params, "us[128]", id, motivo)) return SendClientMessage(playerid, -1, "Use: /banir [id] [motivo]");
    {
        GetPlayerName(id, GNome, sizeof(GNome));
        GetPlayerName(playerid, Nome, sizeof(Nome));
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"O jogador esta offline!");
        format(string,sizeof(string),"SG-RP: %s baniu o jogador %s pelo seguinte motivo: %s",Nome,GNome,motivo);
        SendClientMessageToAll(-1,string);
        format(string,sizeof(string),"Conta: %s\nMotivo: %s\nAdministrador: %s",GNome,motivo,Nome);
        ShowPlayerDialog(id,9,DIALOG_STYLE_MSGBOX,"Vocк foi banido!",string,"Fechar","");
        format(string, 128, "Banidos/%s.ini",GNome);
        getdate(Ano, Mes, Dia);
        gettime(Hora, Minuto, Segundo);
        format(Data, 50, "%d/%d/%d", Dia, Mes, Ano);
        format(Horario, 50, "%d:%d:%d", Hora, Minuto, Segundo);
        if(DOF2_FileExists(string))
        {
            DOF2_SetInt(string,"Admin", Nome);
            DOF2_SetInt(string,"Data", Data);
            DOF2_SetInt(string,"Hora", Horario);
            DOF2_SetInt(string,"Motivo", motivo);
            DOF2_SaveFile();
        }
        Ban(id);
    }
    return 1;
}
Reply
#2

Em vez de DOF2_SetInt tente usar DOF2_SetString
Reply
#3

Obrigado! Mas ele nгo esta salvando a conta banida na pasta Banidos.
Reply
#4

Tenta
pawn Код:
CMD:banir(playerid, params[])
{
    new id, motivo[128], Nome[24], GNome[24], string[200], Ano, Mes, Dia, Hora, Minuto, Segundo, Data[50], Horario[50];
    if(Player[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"Vocк nгo esta autorizado a utilizar este comando!");
    if(sscanf(params, "us[128]", id, motivo)) return SendClientMessage(playerid, -1, "Use: /banir [id] [motivo]");
    {
        GetPlayerName(id, GNome, sizeof(GNome));
        GetPlayerName(playerid, Nome, sizeof(Nome));
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"O jogador esta offline!");
        format(string,sizeof(string),"SG-RP: %s baniu o jogador %s pelo seguinte motivo: %s",Nome,GNome,motivo);
        SendClientMessageToAll(-1,string);
        format(string,sizeof(string),"Conta: %s\nMotivo: %s\nAdministrador: %s",GNome,motivo,Nome);
        ShowPlayerDialog(id,9,DIALOG_STYLE_MSGBOX,"Vocк foi banido!",string,"Fechar","");
        format(string, 128, "Banidos/%s.ini",GNome);
        getdate(Ano, Mes, Dia);
        gettime(Hora, Minuto, Segundo);
        format(Data, 50, "%d/%d/%d", Dia, Mes, Ano);
        format(Horario, 50, "%d:%d:%d", Hora, Minuto, Segundo);
        if(!DOF2_FileExists(string)) { DOF2_CreateFile(string); }
        DOF2_SetInt(string,"Admin", Nome);
        DOF2_SetInt(string,"Data", Data);
        DOF2_SetInt(string,"Hora", Horario);
        DOF2_SetInt(string,"Motivo", motivo);
        DOF2_SaveFile();
        Ban(id);
    }
    return 1;
}
Reply
#5

vlw ana! eu gostaria de saber como faзo para que caso o jogador logue com a conta banida, ele fosse kickado!
Reply
#6

Crie uma variavel e salva na conta ai no OnPlayerConnect usa um if.
Reply
#7

Simples, formata o arquivo, verifica se nele estб setado as tags de ban.. Exemplo:
pawn Код:
new file[56];
format(file, sizeof(file),"Banidos/%s.ini", Nome(playerid));
if(DOF2_FileExists(file) && DOF2_IsSet(file,"Admin") && DOF2_IsSet(file,"Data") && DOF2_IsSet(file,"Hora") && DOF2_IsSet(file,"Motivo"))
{
    SendClientMessage(playerid, -1, "Vocк estб banido, por isso serб kickado.");
    SendClientMessage(playerid, -1, "Foi banido injustamente? Acesse o forum e reclame!");
    Kick(playerid);
    return 1;
}
E a funзгo de pegar nome
pawn Код:
Nome(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
O primeiro cуdigo deve ser colocado na OnPlayerConnect e o segundo onde quiser, desde que seja fora de uma stock/public.
Reply
#8

#edit

Jб postaram acima.


---


Quote:
Originally Posted by humildadeforever
Посмотреть сообщение
Simples, formata o arquivo, verifica se nele estб setado as tags de ban.. Exemplo:
pawn Код:
new file[56];
format(file, sizeof(file),"Contas/%s.ini", Nome(playerid));
if(DOF2_FileExists(file) && DOF2_IsSet(file,"Admin") && DOF2_IsSet(file,"Data") && DOF2_IsSet(file,"Hora") && DOF2_IsSet(file,"Motivo"))
{
    SendClientMessage(playerid, -1, "Vocк estб banido, por isso serб kickado.");
    SendClientMessage(playerid, -1, "Foi banido injustamente? Acesse o forum e reclame!");
    Kick(playerid);
    return 1;
}
E a funзгo de pegar nome
pawn Код:
Nome(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
A pasta nгo й "Banidos"?
Reply
#9

Quote:
Originally Posted by Pedro_Miranda
Посмотреть сообщение
#edit

Jб postaram acima.


---




A pasta nгo й "Banidos"?
Hmm.. Vish, falta de atenзгo minha heuheuh! Vlw por avisar, corrigido.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)