ReturnUser - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ReturnUser (
/showthread.php?tid=142792)
ReturnUser -
Antonio [G-RP] - 20.04.2010
In my /cuff codes and such I have this:
Code:
giveplayerid = ReturnUser(tmp);
I get this error:
Code:
error 017: undefined symbol "ReturnUser"
Re: ReturnUser -
Antonio [G-RP] - 20.04.2010
I put this in my script, and still got errors...
Code:
public ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
userid = INVALID_PLAYER_ID;
else return userid;
}
}
new len = strlen(text[pos]);
new count = 0;
new pname[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, pname, sizeof (pname));
if (strcmp(pname, text[pos], true, len) == 0)
{
if (len == strlen(pname)) return i;
else
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count) SendClientMessage(playerid, COLOR_WHITE, "Enter the full name of the user.");
else SendClientMessage(playerid, COLOR_GREY, "No results found for the specified phrase.");
}
userid = INVALID_PLAYER_ID;
}
return userid;
}
Re: ReturnUser -
cessil - 20.04.2010
can't help unless you tell us the errors