All pastes #445217 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-17 19:29 UTC
rendered paste body
public OnPlayerConnect(playerid)
{
	new playerName[MAX_PLAYER_NAME];
	new string[256];
	GetPlayerName(playerid, playerName, sizeof(playerName));
	format(string, sizeof(string), "[join] : [%d] [%s]", playerid, playerName);
	save(string);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	new playerName[MAX_PLAYER_NAME];
	new string[256];
	GetPlayerName(playerid, playerName, sizeof(playerName));
	format(string, sizeof(string), "[quit] : [%d] [%s]", playerid, playerName);
	save(string);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new playerName[MAX_PLAYER_NAME];
	new killerName[MAX_PLAYER_NAME];
	new string[256];
	GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
	if(killerid != INVALID_PLAYER_ID)
	{
		GetPlayerName(killerid, killerName, MAX_PLAYER_NAME);
		format(string, sizeof(string), "[death] [%d] [%s] [%d] [%s]", playerid, playerName, killerid, killerName);
	}
	else
	{
		format(string, sizeof(string), "[death] [%d] [%s] [] []", playerid, playerName);
	}
	save(string);
	return 1;
}

save(text[])
{
	new File:log = fopen("echo/echo.txt", io_append);
	new string[256];
	format(string, sizeof(string), "%s\r\n", text);
	fwrite(log, string);
	fclose(log);
	return 1;
}