Public feed #892833

Unnamed

public text v1 · immutable
Raw Edit
·published 2008-02-05 18:56 UTC
rendered paste body
stock PlayerName(playerid) {
	new name[255];
	GetPlayerName(playerid, name, sizeof(name));
	return name;
}


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;
}