SA-MP Forums Archive
How to fix this error? - 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)
+--- Thread: How to fix this error? (/showthread.php?tid=597601)



How to fix this error? - Sheperc - 02.01.2016

Код:
stock GetPlayerID(const playername[], partofname=0) //By Jan "DracoBlue" Schьtze (edited by Gabriel "Larcius" Cordes)
{
	new i;
	new playername1[MAX_STRING];
	for (i=0;i<MAX_PLAYERS;i++)
	{
		if (IsPlayerConnected(i))
		{
			GetPlayerName(i,playername1,sizeof(playername1));
			if (strcmp(playername1,playername,true)==0)
			{
				return i;
			}
		}
	}
	new correctsigns_userid=-1;
	new tmpuname[MAX_STRING];
	new hasmultiple=-1;
	if(partofname)
	{
		for (i=0;i<MAX_PLAYERS;i++)
		{
			if (IsPlayerConnected(i))
			{
				GetPlayerName(i,tmpuname,sizeof(tmpuname));
				if (strfind(tmpuname,partofname,true)==0)//line 804
				{
					hasmultiple++;
					correctsigns_userid=i;
				}
				if (hasmultiple>0)
				{
					return -2;
				}
			}
		}
	}
	return correctsigns_userid;
}
This code is from the Useful Functions include (uf.inc). And I keep getting this error:
Код:
pawno\include\uf.inc(804) : error 035: argument type mismatch (argument 2)
Please help me fix this. (will exchange rep for any suggestions)


Additional Information:
• I am now using GetPlayerID in my script, and I am getting this error while using it. I tried removing the GetPlayerID in my script, and the error vanished.

• I started getting this error after I fixed a previous error, which was "redefinition of constant/macro" type on the definition MAX_PICKUPS 999 (again from the include).


Re: How to fix this error? - Infinity - 02.01.2016

What is line 804?


Re: How to fix this error? - Sheperc - 02.01.2016

marked it with purple. Refresh the page if it doesn't show, because i edited.


Re: How to fix this error? - Infinity - 02.01.2016

partofname appears to be an integer. strfind needs a string.


Re: How to fix this error? - Sheperc - 02.01.2016

I see. As I changed:
Код:
if (strfind(tmpuname,partofname,true)==0)
into:
Код:
if (strfind(tmpuname,"partofname",true)==0)
The problem was solved. Not sure if it brings some unneeded consequences. Anyway thanks.