01.12.2011, 10:53
Tenta:
pawn Код:
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;
}