Public feed #892832

Untitled

public text v1 · immutable
Raw Edit
·published 2008-02-05 18:55 UTC
rendered paste body
Name(playerid)
{
	new pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof (pname));
	return pname;
}

public GetIDForName(partialname[]) // By Meredith: Gets the player id for full/partial name match
{
	new g_i;
	new r = -1; // No matches
	for (g_i=0;g_i<MAX_PLAYERS;g_i++)
	{
		if (strcmp(partialname, PlayerName(g_i), true, strlen(partialname)) == 0)
		{
			if (r != -1 && r != -2)
				r = -2; // Multiple matches
			else
				r = g_i; // Player ID
		}
	}
	return r;
}