22.06.2010, 22:15
Okey, I've made this:
And it writes everything nicely, except the .txt file which looks like this:
Someone knows why?
pawn Код:
dcmd_suspend(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return 1;
new id, string[512], server[128], reason, ban[50], ip[50];
if(sscanf(params,"us",id,reason)) return SendHelpMessage(playerid, ".: Usage: /suspend [playerid/partofname] [reason] :.");
if(id == INVALID_PLAYER_ID) return SendErrorMessage(playerid, ".: Info: Player not found :.");
GetPlayerIp(id, ip, sizeof(ip));
format(server,sizeof(server), "* %s %s(%d) Account BANNED %s(%d). Reason: %s. %s *", AdminRankName(playerid), pName(playerid), playerid, pName(id), id, reason, date());
SendClientMessageToAll(COLOR_DARKRED, server);
format(ban, sizeof(ban), "%s\r\n", pName(id));
new File:write = fopen("CLRP/Bans.ban", io_append);
fwrite(write,ban);
fclose(write);
format(string, sizeof(string), "%s %s %s(%d) Account BANNED %s(%d)-(%s). Reason: %s\r\n", date(), AdminRankName(playerid), pName(playerid), playerid, pName(id), id, ip, reason);
new File:Bans = fopen("logs/bans.txt", io_append);
fwrite(Bans,string);
fclose(Bans);
Kick(id);
return 1;
}
Код:
[2010/06/23 - 00:15:55] Owner Peter_Johnson(0) Account BANNED Peter_Johnson(0)-(127.0.0.1). Reason: T* Owner Peter_Johnson(0) Account BANNED Peter_Johnson(0). Reason: Testing. [2010/06/23 - 00:15:55] *