SA-MP Forums Archive
uf include - 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: uf include (/showthread.php?tid=519647)



uf include - Lidor124 - 15.06.2014

I have downloaded the uf include from here: https://sampwiki.blast.hk/wiki/Useful_Functions
I copied the stock GetPlayerID to my script and then compile, then it gives me the following error:

Код:
(34603) : error 035: argument type mismatch (argument 2)
line 34603:

Код:
if (strfind(tmpuname,partofname,true)==0)
Full Code:

Код:
#define MAX_STRING 255
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)
				{
					hasmultiple++;
					correctsigns_userid=i;
				}
				if (hasmultiple>0)
				{
					return -2;
				}
			}
		}
	}
	return correctsigns_userid;
}
please help -_-


Re: uf include - Pillhead2007 - 18.06.2014

wouldn't of used that script personally I would of used this smaller quicker
stock GetName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
then use in a script like GetName(playerid); also works for the ids of players not just name


Re: uf include - Lidor124 - 27.06.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
That function is nothing like what Lidor124 wanted. Anyway, why not use "u" in "sscanf"?
Lol i focused on the GetPlayerID while i always using on sscanf for each command in my script, i didnt pay attention my bad xD :0