public BanLog(string[],playerid) { new entry[128]; new hour,minuite,second; new day,month,year; gettime(hour,minuite,second); getdate(day,month,year); new ip[20]; GetPlayerIp(playerid, ip, sizeof(ip)); format(entry, sizeof(entry), "%s IP:%d | Data: %d.%d.%d | Hora: %d.%d.%d\r<br>\n ",string,ip, day, month,year, hour, minuite, second); new File:hFile; hFile = fopen("Log/Ban.log", io_append); fwrite(hFile, entry); fclose(hFile); } if(strcmp(cmd, "/ban", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "*USA: /ban [playerid] [razгo]"); return 1; } new playa = strval(tmp); GetPlayerName(playa, 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, "USA: /ban [playerid] [razгo]"); return 1; } if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1) { printf("%s",string); format(string, sizeof(string), "*AdmCmd: %s foi banido pelo %s, razгo: %s",giveplayer ,sendername, (result)); SendClientMessageToAll(0xF60000F6, string); Ban(playa); BanLog(string,playa); } else { SendClientMessage(playerid, COLOR_GRAD1, "* Nгo estas autorizado a usar este comando!"); } return 1; }
public BanLog(string[],playerid)
{
new entry[128];
new hour,minuite,second;
new day,month,year;
gettime(hour,minuite,second);
getdate(day,month,year);
new ip[20];
GetPlayerIp(playerid, ip, sizeof(ip));
format(entry, sizeof(entry), "%s IP:%s | Data: %d.%d.%d | Hora: %d.%d.%d\r<br>\n ",string,ip, day, month,year, hour, minuite, second);
new File:hFile;
hFile = fopen("Log/Ban.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}
if(strcmp(cmd, "/ban", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "*USA: /ban [playerid] [razгo]");
return 1;
}
new playa = strval(tmp);
GetPlayerName(playa, 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, "USA: /ban [playerid] [razгo]");
return 1;
}
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1)
{
printf("%s",string);
format(string, sizeof(string), "*AdmCmd: %s foi banido pelo %s, razгo: %s",giveplayer ,sendername, (result));
SendClientMessageToAll(0xF60000F6, string);
Ban(playa);
BanLog(string,playa);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "* Nгo estas autorizado a usar este comando!");
}
return 1;
}
format(entry, sizeof(entry), "%s IP:%d | Data: %d.%d.%d | Hora: %d.%d.%d\r<br>\n ",string,ip, day, month,year, hour, minuite, second);
format(entry, sizeof(entry), "%s IP:%s | Data: %d.%d.%d | Hora: %d.%d.%d\r<br>\n ",string,ip, day, month,year, hour, minuite, second);
Muito Obrigado pela resposta,
Nгo funciona б mesma o que mudou no log foi : Antes no log o ip aparecia um "0" e agora nгo *AdmCmd: Antonio foi banido pelo Ze , razгo: teste IP:0 | Data: 2011.12.1 | Hora: 11.42.13 Antes <br> *AdmCmd: Antonio foi banido pelo Ze , razгo: teste IP: | Data: 2011.12.1 | Hora: 12.25.18 Depois <br> |
Ban(playa);
BanLog(string,playa);
BanLog(string,playa);
Ban(playa);