SA-MP Forums Archive
PM log doesnt work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PM log doesnt work (/showthread.php?tid=88448)



PM log doesnt work - jonybomb - 26.07.2009

I have a script to rcon admins see the pms, but i want make a log for these pms...

pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
new string[256], File:pms=fopen("pms.txt", io_append);
new playername[MAX_PLAYER_NAME];
new recievername[MAX_PLAYER_NAME];

GetPlayerName(recieverid, recievername, sizeof(recievername));
GetPlayerName(playerid, playername, sizeof(playername));
for (new a = 0; a < MAX_PLAYERS; a++)
{
if (IsPlayerConnected(a) && IsPlayerAdmin(a) && a != playerid && a != recieverid)
{
format(string, sizeof(string),"**PM %s to %s: %s  ", playername, recievername, text);
SendClientMessage(a, 0x7E60FFAA, string);
fwrite(pms, string);
fclose(pms);

}
}
return 1;
}
I have this, but doesnt work.. Dont save pms.

Where is the problem?


Re: PM log doesnt work - Jefff - 26.07.2009

Dont save in loop xD
Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	new string[256], File:pms=fopen("pms.txt", io_append);
	new playername[MAX_PLAYER_NAME];
	new recievername[MAX_PLAYER_NAME];

	GetPlayerName(recieverid, recievername, sizeof(recievername));
	GetPlayerName(playerid, playername, sizeof(playername));
	format(string, sizeof(string),"**PM %s to %s: %s", playername, recievername, text);
	fwrite(pms, string);
	fclose(pms);
	for (new a = 0; a < MAX_PLAYERS; a++)
	{
		if (IsPlayerConnected(a) && IsPlayerAdmin(a) && a != playerid && a != recieverid)
		{
			format(string, sizeof(string),"**PM %s to %s: %s", playername, recievername, text);
			SendClientMessage(a, 0x7E60FFAA, string);
		}
	}
	return 1;
}
or

Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	new string[256], File:pms=fopen("pms.txt", io_append);
	new playername[MAX_PLAYER_NAME];
	new recievername[MAX_PLAYER_NAME];

	GetPlayerName(recieverid, recievername, sizeof(recievername));
	GetPlayerName(playerid, playername, sizeof(playername));
	format(string, sizeof(string),"**PM %s to %s: %s", playername, recievername, text);
	fwrite(pms, string);
	fclose(pms);
	for(new a = 0; a < MAX_PLAYERS; a++)
	{
		if (IsPlayerConnected(a) && IsPlayerAdmin(a) && a != playerid && a != recieverid)
		{
			SendClientMessage(a, 0x7E60FFAA, string);
		}
	}
	return 1;
}



Re: PM log doesnt work - jonybomb - 26.07.2009

Ok.... What is loop?