uf.inc - 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.inc (
/showthread.php?tid=585695)
uf.inc -
Sheperc - 15.08.2015
So recently I have included a file named uf.inc to help my scripting, and I experience that the uf.inc has it's own errors. I fixed most of them, but there is one left that I can't figure out. Maybe someone can help me fix it?
Код:
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;
}
Compile:
Код:
C:\Users\PC\Desktop\GTA San Andreas MP [0.3 Server]\pawno\include\uf.inc(803) : error 035: argument type mismatch (argument 2)
Error Line:
Код:
if (strfind(tmpuname,partofname,true)==0)
The person whose answer will get my problem fixed will get a +rep
Re: uf.inc -
Sheperc - 16.08.2015
/bump
Re: uf.inc -
1nspire - 16.08.2015
PHP код:
Yours:
new tmpuname[MAX_STRING];
if (strfind(tmpuname,partofname,true)==0)
PHP код:
new tmpuname[24];
if (strfind(tmpuname[24],partofname,true)==0)
PHP код:
or
if (strfind(tmpuname,partofname,true)==0))
Re: uf.inc -
Vince - 16.08.2015
You should probably just copy the functions that you need rather than the whole file. The uf.inc that's on the wiki includes a bunch of functions that are either ridiculous (who would ban a whole team?), inefficient or in some cases completely obsolete. Most of the distance measuring functions have been implemented as a native and the most efficient way to calculate the distance between two arbitrary points is the VectorSize native. Furthermore, any playername-to-id lookup can be done using the sscanf plugin.