if(strcmp(cmd, "/aviso", true) == 0) { new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), PASTA_CONTAS, aname); if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5){ new tmp[256]; new plid; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, Vermelho, "** Use: /aviso [id] [motivo]"); return 1; } plid = strval(tmp); new pname[MAX_PLAYER_NAME]; GetPlayerName(plid, pname, MAX_PLAYER_NAME); format(file2, sizeof(file2), PASTA_CONTAS, pname); if(IsPlayerConnected(plid)){ new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, Vermelho, "** Use: /aviso [id] [motivo]"); }else{ aviso[plid]+=1; if(aviso[plid]>= 3){ format(string, sizeof(string), "{F81414}{FFFFFF} %s foi kickado por receber 3 puniзхes.",pname); SendClientMessageToAll(0x007FFFAA, string); kick[plid]=1; SetPlayerColor(plid,0xFFFFFFAA); kick(plid); } if(pAdmin[playerid] == 1){ format(string, sizeof(string), "* O moderador %s avisou o jogador %s, Motivo:( %s ), ( %d/3 )", aname,pname,result,aviso[plid]); SendClientMessageToAll(0x007FFFAA, string); return 1; } format(string, sizeof(string), "[BAV-Admin] O administrador(a) %s avisou o jogador %s, Motivo:( %s ), ( %d/3 )", aname,pname,result,aviso[plid]); SendClientMessageToAll(0x007FFFAA, string); } }else{ format(string, sizeof(string), " ** ID %d invбlido!", plid); SendClientMessage(playerid, Vermelho, string); } } return 1; }
//if(aviso[plid]>= 3){
if(aviso[plid]>= 10){
format(string, sizeof(string), "{F81414}{FFFFFF} %s foi kickado por receber 3 puniзхes.",pname);
SendClientMessageToAll(0x007FFFAA, string);
kick[plid]=1;
SetPlayerColor(plid,0xFFFFFFAA);
//kick(plid);
Ban(plid);
}
if(strcmp(cmd, "/aviso", true) == 0)
{ if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: /aviso [id] [motivo]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342) { SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: /aviso [id] [motivo]"); return 1; } PlayerInfo[giveplayerid][pWarns] += 1; if(PlayerInfo[giveplayerid][pWarns] >= 3) { getdate(year, month, day); if(admtrampando[playerid] == 1 && admhide[playerid] == 1) { format(string, sizeof(string), "ADMIN CMD: %s foi banido por %s(Modo Cia), Motivo: %s (%d-%d-%d)", giveplayer, sendername, (result),day,month,year); BanLog(string); format(string, sizeof(string), "ADMIN CMD: %s foi banido por %s (Tinha 3 Avisos), Motivo: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); } else { pban[playerid] += 1; if(pban[playerid] >= { SBan(playerid, "Baniu mais de 8", "Automatico"); return 1; } format(string, sizeof(string), "ADMIN CMD: %s foi banido por %s, Motivo: %s (%d-%d-%d)", giveplayer, sendername, (result),day,month,year); BanLog(string); format(string, sizeof(string), "ADMIN CMD: %s foi banido por %s (Tinha 3 Avisos), Motivo: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); } getdate(Ano, Mes, Dia); SBan(giveplayerid, "Terceiro aviso", sendername); return 1; } format(string, sizeof(string), "Admin: %s avisou %s, Motivo: %s",sendername, giveplayer, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); return 1; } }//not connected } else { SendClientMessage(playerid, COLOR_GRAD1, " Esse nгo й um jogador ativo."); } } return 1; } Nгo sei se ajudei ; - ) |
SaveToFile("Avisos",string);
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
new File:Gleisson, filepath[256], string[256], year,month,day, hour,minute,second;
getdate(year,month,day); gettime(hour,minute,second);
format(filepath,sizeof(filepath),"logs/%s.txt",filename);
Gleisson = fopen(filepath,io_append);
format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",day,month,year,hour,minute,second,text);
fwrite(Gleisson,string);
fclose(Gleisson);
#endif
return 1;
}