GetPlayerID(byname) bug
#1

Hi guys

I use GetPlayerID function to check is player online

For example:
Код:
new id= GetPlayerID("Gospodin");
if(IsPlayerConnected(id))
{
printf("Gospodin is online");
}
Function GetPlayerID

Код:
GetPlayerID(string[])
{
	for(new i = 0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1)
		{
			if(strcmp(Player_Name(i), string, true, strlen(string)) == 0)
			{
				return i;
			}
		}
	}
	return INVALID_PLAYER_ID;
}
Player_Name function(uses in GetPlayerID function)

Код:
Player_Name(id)
{
	new ime[MAX_PLAYER_NAME+1];
 	GetPlayerName(id, ime, sizeof ime);
	return ime;
}
What is bug?
I'm make check to see is "Gospodin" online,but they will give positive result if "Gospodin_" "Gospodin_X" etc are online...But I need to check just if "Gospodin" is online,no other combination...
Reply


Messages In This Thread
GetPlayerID(byname) bug - by GospodinX - 02.06.2018, 17:44
Re: GetPlayerID(byname) bug - by iSpark - 02.06.2018, 18:14
Re: GetPlayerID(byname) bug - by Cell_ - 02.06.2018, 20:03
Re: GetPlayerID(byname) bug - by GTLS - 03.06.2018, 06:19

Forum Jump:


Users browsing this thread: 1 Guest(s)