[Ajuda] Sistema de ban dando crash
#1

Olб pessoal, como jб devem ter lido o titulo do tуpico jб devem saber o que й, vou dar uma explicaзгo bбsica do que ta acontecendo: Quando eu uso o comando que eu criei para poder banir (/ban) o server crasha, mais o server sу crasha quando eu uso os parвmetros certinhos por exemplo: (/ban 1 Teste) o server crasha mais quando escrevo um ID invalido ou esqueзo o motivo o server nгo crasha, entгo eu creio que o Problema deve estar na CallBack que estou usando vou deixar o cуdigo abaixo, se vocкs puderem me ajudar fico grato.

pawn Код:
CMD:ban(playerid, params[]){
    new Texto[128], ID;
    if(PlayerInfo[playerid][Admin] < 2)return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo tem permissгo para usar esse comando.");
    if(PlayerInfo[ID][Admin] > 7) return SendClientMessage(playerid, COLOR_GOLD, "||Aviso|| Nгo se deve banir fundadores.");
    if(sscanf(params,"us[128]",ID,Texto)) return SendClientMessage(playerid,Vermelho,"||USE|| /ban [id] [motivo]");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,Vermelho,"[ERRO] Jogador Nгo Conectado!");
    mBan(playerid, ID, Texto);
    return true;
}
forward mBan(playerid, id, motivo[128]);
public mBan(playerid, id, motivo[128]){
    new str[128],Data[3],Hora[3], NomeID[16], arquivo[64], NomeA[16], pIP[16];
    GetPlayerName(id, NomeID, 16);
    GetPlayerName(playerid, NomeA, 16);
    getdate(Data[0], Data[1], Data[2]);
    gettime(Hora[0], Hora[1], Hora[2]);
    GetPlayerIp(id, pIP, sizeof pIP);
    format(str, 128, " ||SERVER|| O Player (%s) foi banido pelo Administrador (%s) motivo: (%s) ",NomeID, NomeA, motivo);
    SendClientMessageToAll(Vermelho,str);
    format(arquivo, 64,"Bans/%s.ini",NomeID);
    DOF2_CreateFile(arquivo);
    DOF2_SetString(arquivo, "Admin", NomeA);
    DOF2_SetString(arquivo, "Nome", NomeID);
    DOF2_SetString(arquivo, "IP", pIP);
    DOF2_SetString(arquivo, "Motivo", motivo);
    format(str, sizeof(str), "%02d/%02d/%02d", Data[0],Data[1],Data[2]);
    DOF2_SetString(arquivo, "Data", str);
    format(str, sizeof(str), "%02d:%02d:%02d", Hora[0],Hora[1],Hora[2]);
    DOF2_SetString(arquivo, "Horas", str);
    DOF2_SaveFile();
    return true;
}
O cуdigo compila normalmente e tambйm tem a pasta bans nas scriptfiles.
Reply
#2

forward mBan(playerid, id, motivo[]);
public mBan(playerid, id, motivo[])


Debug ajuda ...
Reply
#3

Nгo viaja cara.

16 Caracteres й IP
24 Й Nome!

pawn Код:
forward mBan(playerid, id, motivo[128]);
public mBan(playerid, id, motivo[128]){
    new str[128],Data[3],Hora[3], NomeID[24], arquivo[64], NomeA[24], pIP[16];
    GetPlayerName(id, NomeID, 24);
    GetPlayerName(playerid, NomeA, 24);
    getdate(Data[0], Data[1], Data[2]);
    gettime(Hora[0], Hora[1], Hora[2]);
    GetPlayerIp(id, pIP, sizeof pIP);
    format(str, 128, " ||SERVER|| O Player (%s) foi banido pelo Administrador (%s) motivo: (%s) ",NomeID, NomeA, motivo);
    SendClientMessageToAll(Vermelho,str);
    format(arquivo, 64,"Bans/%s.ini",NomeID);
    DOF2_CreateFile(arquivo);
    DOF2_SetString(arquivo, "Admin", NomeA);
    DOF2_SetString(arquivo, "Nome", NomeID);
    DOF2_SetString(arquivo, "IP", pIP);
    DOF2_SetString(arquivo, "Motivo", motivo);
    format(str, sizeof(str), "%02d/%02d/%02d", Data[0],Data[1],Data[2]);
    DOF2_SetString(arquivo, "Data", str);
    format(str, sizeof(str), "%02d:%02d:%02d", Hora[0],Hora[1],Hora[2]);
    DOF2_SetString(arquivo, "Horas", str);
    DOF2_SaveFile();
    return true;
}
Reply
#4

Obrigado ViniBorn e Garfield funciono agora.
Reply
#5

Quote:
Originally Posted by matheus_alcapone
Посмотреть сообщение
Obrigado ViniBorn e Garfield funciono agora.
Pode usar DOF2::SetInt( file, TagName, Value ); no IP
Reply
#6

Obrigado por avisar Schocc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)